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 }}
{% for key, value in groups.iteritems() %}
{% if groups[key] %}
{% if env == "staging" %}
define hostgroup{
hostgroup_name {{ key }}
alias {{ key }}
members {% for host in groups[key] %}{% if (hostvars[host].env is defined) and (hostvars[host].env == 'staging') %} {{host}}, {% endif %} {% endfor %}
hostgroup_name all
alias all
members {% for host in groups['all'] %}{% if (hostvars[host].env is defined) and (hostvars[host].env == 'staging') %} {{host}}, {% endif %} {% endfor %}
}
{% endif %}
{% 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 %}