Ansible "No Hosts Matched"


I am deploying an app in azure, but I am having problems with provisioning, specifically with Ansible and vagrant.

I do not know very well what to do from here, since technically they are executing the same thing and doing it Ansible-playbook playbook.yml directly works, but doing it from the "Vagrantfile" with

vagrant provision 

I get the following error;

    default: Running ansible-playbook...
 [WARNING]: Could not match supplied host pattern, ignoring: snowmetiv

PLAY [snowmetiv] ***************************************************************
skipping: no hosts matched

Here you can see the result of doing it with Ansible-playbook directly;

ansible-playbook playbook.yml

PLAY [snowmetiv] ***************************************************************

TASK [Gathering Facts] *********************************************************
ok: [xxx.xx.xx.xx]

Here is the Vagrantfile file:

   Vagrant.configure('2') do |config| = 'azure'

  # use local ssh key to connect to remote vagrant box
  config.ssh.private_key_path = '~/.ssh/id_rsa'
  config.vm.provider :azure do |azure, override|
  config.vm.synced_folder ".", "/vagrant", disabled: true

    # each of the below values will default to use the env vars named as below if not specified explicitly

    azure.tenant_id = ENV['AZURE_TENANT_ID']
    azure.client_id = ENV['AZURE_CLIENT_ID']
    azure.client_secret = ENV['AZURE_CLIENT_SECRET'] 
    azure.subscription_id = ENV['AZURE_SUBSCRIPTION_ID']

    azure.vm_name = 'snowmetiv'
    azure.vm_size = 'Standard_A1'
    azure.tcp_endpoints = '80'


  config.vm.provision :ansible do |ansible|
      ansible.playbook = "provision/playbook.yml"


Here the hosts;

xxx.xx.xx.xx ansible_ssh_user=vagrant

Here the playbook.yml;

- hosts: snowmetiv
  become: yes
  remote_user: vagrant

  - name: Actualizar sistema
    command: apt-get update

Say that I also have the ansible.cfg file configured to correctly take the "hosts".

asked by Juan Alvarez 20.12.2018 в 20:51

0 answers