Make hosts file dynamic according to machine type
This commit is contained in:
parent
2ed912de44
commit
a15eb67a0f
|
@ -10,7 +10,19 @@ ff02::1 ip6-allnodes
|
|||
ff02::2 ip6-allrouters
|
||||
ff02::3 ip6-allhosts
|
||||
|
||||
# Static hostnames for VMs
|
||||
{% if hostname in groups['virtualservers'] %}
|
||||
# Static hostnames for other VMs
|
||||
{% for host in groups['virtualservers'] %}
|
||||
{{ hostvars[host].private_ip }} {{ hostvars[host].fqdn }}
|
||||
{% endfor %}
|
||||
{% elif hostname in groups['control_infr'] %}
|
||||
# Static hostnames for VM hosts
|
||||
{% for host in groups['vmhost_infr'] %}
|
||||
{{ hostvars[host].ansible_host }} {{ hostvars[host].fqdn }}
|
||||
{% endfor %}
|
||||
|
||||
# Static hostnames for VMs
|
||||
{% for host in groups['virtualservers'] %}
|
||||
{{ hostvars[host].ansible_host }} {{ hostvars[host].fqdn }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
|
Loading…
Reference in a new issue