Consolidate hosts template
For alpine, debian, ceph and proxmox roles. Add the union of IPv6 LL host entries across all distros to make sure nothing croaks.
This commit is contained in:
parent
35427f1fbc
commit
e754db5fbd
|
@ -1,2 +0,0 @@
|
||||||
127.0.0.1 {{ dns_name }} {{ dns_name | split('.') | first }} localhost.localdomain localhost
|
|
||||||
::1 localhost localhost.localdomain
|
|
|
@ -1,10 +0,0 @@
|
||||||
127.0.0.1 localhost
|
|
||||||
::1 localhost ip6-localhost ip6-loopback
|
|
||||||
ff02::1 ip6-allnodes
|
|
||||||
ff02::2 ip6-allrouters
|
|
||||||
|
|
||||||
{% for node in nodes %}
|
|
||||||
{% for address in node|device_address %}
|
|
||||||
{{ address.address | ipaddr('address') }} {{ node.inventory_hostname }}
|
|
||||||
{% endfor %}
|
|
||||||
{% endfor %}
|
|
|
@ -1,12 +0,0 @@
|
||||||
127.0.0.1 localhost.localdomain localhost
|
|
||||||
|
|
||||||
::1 ip6-localhost ip6-loopback
|
|
||||||
fe00::0 ip6-localnet
|
|
||||||
ff00::0 ip6-mcastprefix
|
|
||||||
ff02::1 ip6-allnodes
|
|
||||||
ff02::2 ip6-allrouters
|
|
||||||
ff02::3 ip6-allhosts
|
|
||||||
|
|
||||||
{% for address in interfaces | selectattr('name', '==', 'lo') | map(attribute='ip_addresses') | first %}
|
|
||||||
{{ address.address | ipaddr('address') }} {{ address.dns_name }} {{ inventory_hostname }}
|
|
||||||
{% endfor %}
|
|
15
templates/hosts.j2
Normal file
15
templates/hosts.j2
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
127.0.0.1 localhost
|
||||||
|
::1 localhost ip6-localhost ip6-loopback
|
||||||
|
fe00::0 ip6-localnet
|
||||||
|
ff00::0 ip6-mcastprefix
|
||||||
|
ff02::1 ip6-allnodes
|
||||||
|
ff02::2 ip6-allrouters
|
||||||
|
ff02::3 ip6-allhosts
|
||||||
|
|
||||||
|
{# Static entries for all nodes in the cluster or just this one if there is no cluster. #}
|
||||||
|
{% for address in nodes | default([hostvars[inventory_hostname]])
|
||||||
|
| map(attribute='interfaces') | flatten
|
||||||
|
| map(attribute='ip_addresses') | flatten
|
||||||
|
| selectattr('dns_name') %}
|
||||||
|
{{ address.address | ipaddr('address') }} {{ address.dns_name }} {{ address.dns_name | split('.') | first }}
|
||||||
|
{% endfor %}
|
Loading…
Reference in a new issue