commit 1637341f2648270597074c8467cf0a7891132908
Author: Nicolas Chauvet <kwizart(a)gmail.com>
Date: Thu Nov 19 18:27:48 2020 +0100
Update hosts role
roles/hosts/files/base | 2 ++
roles/hosts/tasks/main.yml | 18 ++++++++----------
2 files changed, 10 insertions(+), 10 deletions(-)
---
diff --git a/roles/hosts/files/base b/roles/hosts/files/base
new file mode 100644
index 0000000..849c10d
--- /dev/null
+++ b/roles/hosts/files/base
@@ -0,0 +1,2 @@
+127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
+::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
diff --git a/roles/hosts/tasks/main.yml b/roles/hosts/tasks/main.yml
index 55c7537..248b770 100644
--- a/roles/hosts/tasks/main.yml
+++ b/roles/hosts/tasks/main.yml
@@ -1,25 +1,23 @@
---
#
-# This task sets up /etc/hosts on a machine.
+# This task sets up /etc/hosts on a machine.
#
# This should only be used in rare cases
#
#
# This will move a /etc/hosts in place if it's setup in files for that host/domain
-# Note that if it's not set it will just skip this play and do nothing.
+# Note that if it's not set it will just skip this play and do nothing.
#
- name: setup /etc/hosts for some clients
copy: src={{ item }} dest=/etc/hosts
with_first_found:
- - files:
- - "{{ inventory_hostname }}-hosts"
- - "{{ ansible_fqdn }}-hosts"
- - "{{ ansible_hostname }}-hosts"
- - "{{ host_group }}-hosts"
- - "{{ ansible_domain }}-hosts"
- - "{{ datacenter }}-hosts"
- skip: true
+ - "{{ inventory_hostname }}-hosts"
+ - "{{ ansible_hostname }}-hosts"
+ - "{{ host_group }}-hosts"
+ - "{{ ansible_domain }}-hosts"
+ - "{{ datacenter }}-hosts"
+ - base
tags:
- config
- hosts