Hello everyone,
I’m trying to use a combine call to AWS tags within a jinja template so I can select nodes for a cassandra cluster.
- seeds: {% set comma = joiner(“,”) %}
{% for server in groups[ ‘tag_env_{{ env }}:&tag_role_{{ role }}’ ] -%}
{{ comma() }}{{ hostvars[server].ansible_eth0.ipv4.address }}
{%- endfor %}
Where {{ env }} and {{ role }} are passed as extra-varas when running the playbook but seems that is not being reconginzed as a valid, here is the error:
{“src”: “templates/cassandra.yaml.j2”}, “module_name”: “template”}, “msg”: “AnsibleUndefinedVariable: ‘dict object’ has no attribute ‘tag_env_{{ env }}:&tag_role_{{ role }}’”
But I use that same combination to select initially the hosts on which to run the playbook as in:
hosts: tag_env_{{ env }}:&tag_role_{{ role }}
Any ideas on why or what may be failing with the jinja template?
Thank you