i tag hosts with tag ENV and call ansible with --limit tag_ENV_staging to get only hosts of staging
At the same time, i have another ENV called production
in my template i use loop on groups[‘mgmt’] to get list of all ‘mgmt’ hosts to put them to some config file
{% for host in groups[‘mgmt’] %}{{ hostvars[host][ec2_private_ip_address] }}{% if not loop.last %},{% endif %}{% endfor %}
but i got both staging and production hosts, but template is updated only on staging
it is possible that --limit has bug or groups is not respect --limit??