I'm following an Ansible tutorial I got from Packt, I reached this part where I've created 3 Ubuntu containers (lxc) and got them up and running. I'm also able to login to each of them.
I've downloaded Ansible by doing: git clone ansible-git-url
and then sourced it.
My working setup is as follows:
/home/myuser/code
in here I have 2 folders: ansible
(the whole git repo) and ansible_course
where I have 2 files: ansible.cfg
and inventory
.
inventory
contains the following:
[allservers]
192.168.122.117
192.168.122.146
192.168.122.14
[web]
192.168.122.146
192.168.122.14
[database]
192.168.122.117
And ansible.cfg
contains:
[root@localhost ansible_course]# cat ansible.cfg
[defaults]
host_key_checking = False
Then from this path: /home/myuser/code/ansible_course
I try to execute the following:
$ ansible 192.168.122.117 -m ping -u root
The guy from the tutorial does exactly like this, and he gets success response from the ping
, but I get the following error messages:
[WARNING]: Unable to parse /etc/ansible/hosts as an inventory source
[WARNING]: No inventory was parsed, only implicit localhost is available
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'
[WARNING]: Could not match supplied host pattern, ignoring: 192.168.122.117
In the tutorial, he never says that I need to do something special in order to give an inventory
source, he just says that we need to create an inventory
file with the IP addresses of the Linux containers that we have.
I mean, he doesn't say that we need to execute a command to set this up.
<br>
tags in your ansible.cfg?