From 263c26ac2f812efc9080999a023edb4eeb33cd17 Mon Sep 17 00:00:00 2001 From: Evgeni Golov Date: Fri, 27 Sep 2024 08:17:55 +0200 Subject: [PATCH] Revert "use ansible_default_ipv4 if possible when writing /etc/hosts" This reverts commit c2bdd33a625bbf5f80af3aa57c4820dd8ec33349. --- roles/etc_hosts/tasks/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/etc_hosts/tasks/main.yml b/roles/etc_hosts/tasks/main.yml index 8141a3705..e0f3f8c68 100644 --- a/roles/etc_hosts/tasks/main.yml +++ b/roles/etc_hosts/tasks/main.yml @@ -3,7 +3,7 @@ lineinfile: dest: /etc/hosts regexp: ".*{{ item.replace('.', '-') }}$" - line: "{{ ansible_default_ipv4['address'] | default(hostvars[item].ansible_host) }} {{ item.replace('.', '-') }}.{{ etc_hosts_domain }} {{ item.replace('.', '-') }}" + line: "{{ hostvars[item].ansible_host }} {{ item.replace('.', '-') }}.{{ etc_hosts_domain }} {{ item.replace('.', '-') }}" state: present when: hostvars[item].ansible_host is defined become: yes