Added variant with YAML linebreaks for slides
This commit is contained in:
parent
b6bf9ebce3
commit
526b7e4bb5
27
tasks/main_linebreak.yml
Normal file
27
tasks/main_linebreak.yml
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
---
|
||||||
|
- name: Detect domain name
|
||||||
|
set_fact:
|
||||||
|
domainname: "{{ ansible_dns.domain|default(False) or ansible_dns.search.0|default(False) or ansible_domain|default(False) or 'invalid'}}"
|
||||||
|
|
||||||
|
- name: Add name/IP to hosts file
|
||||||
|
lineinfile: >
|
||||||
|
dest=/etc/hosts
|
||||||
|
regexp='^{{ ansible_default_ipv4.address }}'
|
||||||
|
line='{{ ansible_default_ipv4.address }} {{ ansible_hostname }}.{{ domainname }} {{ ansible_hostname }}'
|
||||||
|
backup=yes
|
||||||
|
|
||||||
|
- name: Clean/remove 127.0.1.1
|
||||||
|
lineinfile: >
|
||||||
|
dest=/etc/hosts
|
||||||
|
regexp='^127.0.1.1'
|
||||||
|
state=absent
|
||||||
|
backup=yes
|
||||||
|
|
||||||
|
- name: Ensure 127.0.0.1 localhost
|
||||||
|
lineinfile: >
|
||||||
|
dest=/etc/hosts
|
||||||
|
regexp='127.0.0.1'
|
||||||
|
line='127.0.0.1 localhost localhost.localdomain'
|
||||||
|
insertbefore=BOF
|
||||||
|
backup=yes
|
||||||
|
|
Loading…
Reference in a new issue