step 02
This commit is contained in:
parent
bbe354f7fe
commit
e4250e901a
1 changed files with 17 additions and 5 deletions
|
@ -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 %}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue