Initial commit
This commit is contained in:
commit
495ce63cdf
30
tasks/main.yml
Normal file
30
tasks/main.yml
Normal file
|
@ -0,0 +1,30 @@
|
|||
---
|
||||
- name: Add name/IP to hosts file
|
||||
lineinfile:
|
||||
dest: /etc/hosts
|
||||
regexp: '^{{ ansible_default_ipv4.address }}.*{{ ansible_hostname }}\.ansible\.kurs.*{{ ansible_hostname }}'
|
||||
line: '{{ ansible_default_ipv4.address }} {{ ansible_hostname }}.ansible.kurs {{ ansible_hostname }}'
|
||||
backup: yes
|
||||
|
||||
- name: Clean/remove 127.0.1.1
|
||||
lineinfile:
|
||||
dest: /etc/hosts
|
||||
regexp: '127.0.1.1.*{{ ansible_hostname }}'
|
||||
state: absent
|
||||
backup: yes
|
||||
|
||||
- name: Clean/remove 127.0.0.1 ... Hostname
|
||||
lineinfile:
|
||||
dest: /etc/hosts
|
||||
regexp: '127.0.0.1.*{{ ansible_hostname }}'
|
||||
state: absent
|
||||
backup: yes
|
||||
|
||||
- name: Ensure 127.0.0.1 localhost
|
||||
lineinfile:
|
||||
dest: /etc/hosts
|
||||
regexp: '127.0.0.1.*localhost'
|
||||
line: '127.0.0.1 localhost localhost.localdomain # from Ansible'
|
||||
insertbefore: BOF
|
||||
backup: yes
|
||||
|
Loading…
Reference in a new issue