Skip to content

Commit 7bed8d0

Browse files
committed
more
1 parent 5276ee8 commit 7bed8d0

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

tests/inventory.yaml.j2

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
all:
22
hosts:
3-
{% for host in hostvars.keys() | reject("match", "^localhost") %}
4-
{{ host }}:
5-
{% for key in ["ansible_all_ipv4_addresses", "ansible_all_ipv6_addresses",
3+
{{ inventory_hostname }}:
4+
{% for key in ["ansible_all_ipv4_addresses", "ansible_all_ipv6_addresses",
65
"ansible_default_ipv4", "ansible_default_ipv6", "ansible_host",
76
"ansible_port", "ansible_ssh_common_args",
87
"ansible_ssh_private_key_file","ansible_user"] %}
9-
{% if key in hostvars[host] %}
10-
{{ key }}: {{ hostvars[host][key] }}
11-
{% endif %}
12-
{% endfor %}
8+
{% if key in hostvars[inventory_hostname] %}
9+
{{ key }}: {{ hostvars[inventory_hostname][key] }}
10+
{% endif %}
1311
{% endfor %}

0 commit comments

Comments
 (0)