This commit is contained in:
Stephen Smoogen 2017-01-10 17:50:20 +00:00
parent bbe354f7fe
commit e4250e901a

View file

@ -3,16 +3,28 @@
############### ###############
## {{ env }} ## {{ env }}
{% for key, value in groups.iteritems() %} {% if env == "staging" %}
{% if groups[key] %}
define hostgroup{ define hostgroup{
hostgroup_name {{ key }} hostgroup_name all
alias {{ key }} alias all
members {% for host in groups[key] %}{% if (hostvars[host].env is defined) and (hostvars[host].env == 'staging') %} {{host}}, {% endif %} {% endfor %} members {% for host in groups['all'] %}{% if (hostvars[host].env is defined) and (hostvars[host].env == 'staging') %} {{host}}, {% endif %} {% endfor %}
} }
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{% else %}
{% for key, value in groups.iteritems() %}
{% if groups[key] %}
define hostgroup{
hostgroup_name {{ key }}
alias {{ key }}
members {% for host in groups[key] %}{{host}}, {% endfor %}
}
{% endfor %}
{% endif %}