Ansible iterate over hosts in inventory group set by variable

后端 未结 1 1452
挽巷
挽巷 2021-01-27 23:46

I have the next snippet in my role template:

upstream portal {
 {% set nodes = groups[\"my_dev_cluster\"] %}
 {% for node in nodes %}
 ...do something with nodes         


        
相关标签:
1条回答
  • 2021-01-28 00:40

    You don't need {{...}} because you're already inside a jinja context (in this case, the {% set ... %} block. Just write:

    {% set nodes = groups[cluster_name] %}
    
    0 讨论(0)
提交回复
热议问题