From a760d6f3fbec55d32f1898f3a59dff1779d2cda9 Mon Sep 17 00:00:00 2001 From: Mike Holloway Date: Mon, 16 Sep 2024 22:28:29 -0400 Subject: [PATCH] Add hosts file entry for inventory_hostname --- tasks/main.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tasks/main.yml b/tasks/main.yml index a6575f0..aa71b5a 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -26,6 +26,23 @@ selinux_permissive: name: container_t permissive: true + +- name: Add hosts file entry for hostname + lineinfile: + path: /etc/hosts + regexp: '^127\.0\.0\.1' + line: "127.0.0.1 {{ inventory_hostname }} localhost localhost.localdomain localhost4 localhost4.localdomain4" + owner: root + group: root + mode: 0644 + +- lineinfile: + path: /etc/hosts + regexp: '^::1' + line: "::1 {{ inventory_hostname }} localhost localhost.localdomain localhost6 localhost6.localdomain6" + owner: root + group: root + mode: 0644 # - name: Copy cni networking driver config into place # blockinfile: # name: "/etc/cni/net.d/podman.conflist"