Ansible not connecting to all hosts if using common azure cloud service for multiple VMs

36 views
Skip to first unread message

satheesh kumar

unread,
May 5, 2015, 5:32:01 PM5/5/15
to ansible...@googlegroups.com
I am using a single cloud service in azure, which acts as loadbalancer for two backend hosts. The SSH public port is 22 for VM1 and 26 for VM2.

My Ansible inventory file is like below:

[webservers]
web.cloudapp.net  ansible_ssh_port=22
web.cloudapp.net  ansible_ssh_port=26


When I ping the VMs

# ansible webservers -m ping

I am getting response only once (I expected twice for each VM)

web.cloudapp.net | success >> {
    "changed": false,
    "ping": "pong"
}

I tried commenting one vm1 in inventory and I am getting response from VM2 (I tried commenting VM2 also and got ping response from vm1)

Then I ran ansible-playbook on the same inventory (with 2 VMs) files and i am able to see changes only in second VM with port 26.

I tried this in different VM set and each time I am able to see changes only in port 26 VM, not the other one in port 22.

Can you help me in getting the ansible executing on both VMs when defined at same time

Matt Martz

unread,
May 5, 2015, 6:26:09 PM5/5/15
to ansible...@googlegroups.com
Hosts must have a unique name in inventory.

Both of your hosts have the same name.

You can use ansible_ssh_host to specify a single host/ip and give the hosts unique aliases instead.

Similar too 

[webservers]
web1 ansible_ssh_host=web.cloudapp.net 
ansible_ssh_port=22
web2 ansible_ssh_host=web.cloudapp.net  ansible_ssh_port=26
--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/3ab17df0-4f35-4835-a3a3-0640d943ae8e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
Matt Martz
@sivel
sivel.net

satheesh kumar

unread,
May 5, 2015, 6:31:04 PM5/5/15
to ansible...@googlegroups.com
Thanks! let me try this option!
Reply all
Reply to author
Forward
0 new messages