ansible-playbook --limit not working with overlapping host aliases -


im having problem limiting ansible work specific host

my inventory file looks this:

[staging-docker-containers] app1 ansible_host=host.domain.com ansible_ssh_port=2222   app2 ansible_host=host.domain.com ansible_ssh_port=2223   app3 ansible_host=host.domain.com ansible_ssh_port=2224    [staging-other-servers] app1 ansible_host=host.domain.com ansible_ssh_port=2225   app2 ansible_host=host.domain.com ansible_ssh_port=2226   app3 ansible_host=host.domain.com ansible_ssh_port=2227   

when run follow command

ansible-playbook --limit="staging-docker-containers:app3"  my-playbook.yml -i staging  

it ignores limit command , tries connect app3 under staging-other-servers group, , not app3 under staging-docker-containers group.

am doing wrong?

you can have same host in different groups.
can't have different hosts under same name.
if define same host variables same host in different places, latter have priority.
inventory becomes:

[staging-docker-containers] app1 app2 app3  [staging-other-servers] app1 ansible_host=host.domain.com ansible_ssh_port=2225 app2 ansible_host=host.domain.com ansible_ssh_port=2226 app3 ansible_host=host.domain.com ansible_ssh_port=2227 

Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -