【发布时间】:2017-01-20 17:55:50
【问题描述】:
我有 3 台服务器 A、B、C。当我在 j2 模板中运行以下内容时,它会拉取所有 3 台服务器。
如何忽略运行模板的服务器?
例如,如果服务器 A 运行,它应该只获取服务器 B 和 C。
"retry_join": ["
{% for host in groups['servers']%}
{{ hostvars[host]['ansible_ssh_host'] }}
{% if not loop.last %}, {% endif %}
{% endfor %}
"]
【问题讨论】: