You've already forked role_dnsmasq
[EVO] Utiliser l'inventaire d'ansible
This commit is contained in:
13
templates/ansible_inventory.conf.j2
Normal file
13
templates/ansible_inventory.conf.j2
Normal file
@@ -0,0 +1,13 @@
|
||||
# {{ ansible_managed }}
|
||||
|
||||
{% for ip in dnsmasq_host_ips %}
|
||||
{% endfor %}
|
||||
|
||||
{% set last_host = groups['all'] | last %}
|
||||
{% for host in groups['all'] %}
|
||||
{% if hostvars[host].get('ansible_host', false) %}
|
||||
{% set hostnames = [hostvars[host]['inventory_hostname']] + [hostvars[host]['inventory_hostname_short']] + hostvars[host]['dnsmasq_host_aliases'] %}
|
||||
{{ ip }} {{ hostnames | select() | join(' ') }}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
Reference in New Issue
Block a user