2016-11-07 14:00:57 +01:00
|
|
|
---
|
|
|
|
- name: Set hostname "{{ evolinux_hostname }}"
|
|
|
|
hostname:
|
|
|
|
name: "{{ evolinux_hostname }}"
|
|
|
|
|
|
|
|
- name: Set right localhost line in /etc/hosts
|
|
|
|
replace:
|
|
|
|
dest: /etc/hosts
|
|
|
|
regexp: '^127.0.0.1(\s+)localhost.*$'
|
|
|
|
replace: '127.0.0.1\1localhost.localdomain localhost'
|
|
|
|
|
|
|
|
- name: Set ip+fqdn+hostname in /etc/hosts
|
|
|
|
lineinfile:
|
|
|
|
dest: /etc/hosts
|
2016-12-27 16:45:46 +01:00
|
|
|
regexp: '^{{ ansible_default_ipv4.address }}\s+'
|
2016-11-07 14:00:57 +01:00
|
|
|
line: "{{ ansible_default_ipv4.address }} {{ evolinux_fqdn }} {{ evolinux_hostname }}"
|
|
|
|
insertafter: '127.0.0.1\s+localhost.localdomain'
|
|
|
|
|
|
|
|
- name: 127.0.1.1 is removed
|
|
|
|
lineinfile:
|
|
|
|
dest: /etc/hosts
|
2016-12-27 18:40:24 +01:00
|
|
|
regexp: '^127.0.1.1\s+'
|
2016-11-07 14:00:57 +01:00
|
|
|
state: absent
|
|
|
|
|
2016-12-30 10:40:44 +01:00
|
|
|
- name: /etc/mailname is up-to-date
|
|
|
|
copy:
|
|
|
|
dest: /etc/mailname
|
|
|
|
content: "{{ evolinux_fqdn }}\n"
|
|
|
|
force: yes
|
|
|
|
|
2016-11-07 14:00:57 +01:00
|
|
|
- name: override ansible_hostname fact
|
|
|
|
set_fact:
|
|
|
|
ansible_hostname: "{{ evolinux_hostname }}"
|
|
|
|
when: ansible_hostname != evolinux_hostname
|
|
|
|
|
|
|
|
- name: override ansible_domain fact
|
|
|
|
set_fact:
|
|
|
|
ansible_domain: "{{ evolinux_domain }}"
|
|
|
|
when: ansible_domain != evolinux_domain
|
|
|
|
|
|
|
|
- name: override ansible_fqdn fact
|
|
|
|
set_fact:
|
|
|
|
ansible_fqdn: "{{ evolinux_fqdn }}"
|
|
|
|
when: ansible_fqdn != evolinux_fqdn
|