I have installed Vagrant, VirtualBox and Ansible and trying to run provision over one host but it always returns \"skipping: no hosts matched\"
The head of my playbook f
I tried pointing the groups to default vagrant box and it worked. Refer https://gagor.pl/2015/12/ansible-on-vagrant-skipping-no-hosts-matched/
ansible.groups = {
'webservers' => ['default']
}
You can run your playbook in verbose mode by adding -vvvv in the end. Ansible uses host file from /etc/ansible/hosts add the below
You can check what inventory file is being used by your ansible by below
ansible --version
ansible 2.0.0.2
config file = /etc/ansible/ansible.cfg
configured module search path = Default w/o overrides
Then check your host file if it contains the exact group for host
vim /etc/ansible/hosts
[webserver1]
IP of machine
check by running the below command
ansible -m ping 10.0.3.145 (IP Of machine)
10.0.3.145 | SUCCESS => {
"changed": false,
"ping": "pong"
}
This should fix the issue.
It could help to post your Vagrantfile and your ansible inventory file.
Are you using the default ansible provider of vagrant?
did you specify the inventory_path
?
config.vm.provision :ansible do |ansible| ansible.playbook = "provisioning/playbook.yml" ansible.inventory_path = "provisioning/ansible_hosts" end
--connection=local
try a /etc/ansible/hosts[webserver1] 127.0.0.1 ansible_connection=local