I ran into what seemed to me like a strange problem today, but I might just lack the understanding to know what was happening.
Let’s say you have a YAML file called ec2.yml to run against that looks like this:
`
I ran into what seemed to me like a strange problem today, but I might just lack the understanding to know what was happening.
Let’s say you have a YAML file called ec2.yml to run against that looks like this:
`
limit filters the available host list, since both hosts have the host2
tag, it does not modify the list of hosts in the play.
it reads like this once resolved
- hosts: "tag_ansible_hosts1:&tag_ansible_host2"
...
- hosts: "tag_ansible_hosts2:&tag_ansible_hosts2"
It does not limit to an existing play declaration, but imposes
additional limits to those. What you seem to want is play tags.
- hosts: tag_ansible_host1
tags:
- host1
roles:
- role1
- role2
- hosts: tag_ansible_host2
tags:
- host2
roles:
- role2
and then run ansible with -t 'host2'
Thanks so much Brian. That makes a lot of sense now.