You've already forked ansible-role-common
Second attempt non breaking hosts config
This commit is contained in:
@@ -84,16 +84,16 @@
|
||||
- name: Ensure hosts file correct
|
||||
lineinfile:
|
||||
dest: /etc/hosts
|
||||
regexp: "^127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4"
|
||||
line: "127.0.0.1 localhost {{ ansible_hostname }}"
|
||||
regexp: "{{ item.regexp }}"
|
||||
line: "{{ item.line }}"
|
||||
with_items:
|
||||
- {regexp: "^127.0.0.1 localhost.+",
|
||||
- {regexp: "^127.0.0.1.+localdomain4$",
|
||||
line: "127.0.0.1 localhost {{ ansible_hostname }}"
|
||||
}
|
||||
- {regexp: "^::1.+",
|
||||
- {regexp: "^::1.+localdomain6$",
|
||||
line: "::1 localhost {{ ansible_hostname }}"
|
||||
}
|
||||
- {regexp: "^{{ ansible_default_ipv4.address }}.+{{ ansible_default_ipv4.address.split('.')[-1] }}$",
|
||||
- {regexp: "^{{ ansible_default_ipv4.address }}.*{{ ansible_default_ipv4.address.split('.')[-1] }}$",
|
||||
line: "{{ ansible_default_ipv4.address }} {{ ansible_hostname }}.{{ domain }} {{ ansible_hostname }}"
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user