Set-OPS-Public/roles/hosts_statiques/templates/hosts.j2

13 lines
690 B
Text
Raw Normal View History

# /etc/hosts — GÉNÉRÉ par Set-OPS (rôle hosts_statiques) depuis l'inventaire.
# Plancher de résolution interne, indépendant du serveur DNS. NE PAS éditer à la main.
127.0.0.1 localhost
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
# --- Écosystème (dérivé du plan ; chaque hôte → son IP réelle) ---
{% set fleet = (groups.get('hotes_actifs', []) + groups.get('hotes_planifies', [])) | unique | sort %}
{% for h in fleet if hostvars[h].ansible_host is defined %}
{{ "%-15s" | format(hostvars[h].ansible_host) }} {{ h }}{{ (' ' ~ h ~ '.' ~ hosts_statiques_domaine) if hosts_statiques_domaine else '' }}
{% endfor %}