I have just started with Ansible and after writing a small inventory as mentioned below
vagrant@acs:~/ex2$ cat prod_inventory
web1 192.168.33.20
db1 192.168.33.30
[webserver]
web1
[dbserver]
db1
[all:children]
webserver
dbserver
[all:vars]
ansible_ssh_user=vagrant
ansible_ssh_pass=vagrant
I am getting below error while using a ping module
vagrant@acs:~/ex2$ ansible all -i prod_inventory -m ping
ERROR: Invalid ini entry: 192.168.33.20 - need more than 1 value to unpack
vagrant@acs:~/ex2$
not getting what I am missing here.
Please help
The first two lines of your inventory file are incorrect:
web1 192.168.33.20
db1 192.168.33.30
If you want to assign an IP address to a host, you need to do it using the proper syntax:
[webserver]
web1 ansible_host=192.168.33.20
[dbserver]
db1 ansible_host=192.168.33.30
Read the documentation first before trying on a random basis. It is clearly specified:
Suppose you have just static IPs and want to set up some aliases that live in your host file, or you are connecting through tunnels. You can also describe hosts like this:
jumper ansible_port=5555 ansible_host=192.0.2.50