2016-11-07 14:00:57 +01:00
|
|
|
---
|
2017-11-22 14:08:54 +01:00
|
|
|
- name: dbus is installed
|
|
|
|
apt:
|
|
|
|
name: dbus
|
|
|
|
state: installed
|
|
|
|
|
2016-11-07 14:00:57 +01:00
|
|
|
- name: Set hostname "{{ evolinux_hostname }}"
|
|
|
|
hostname:
|
|
|
|
name: "{{ evolinux_hostname }}"
|
2017-04-21 14:11:17 +02:00
|
|
|
when: evolinux_hostname_hosts
|
2016-11-07 14:00:57 +01:00
|
|
|
|
|
|
|
- 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'
|
2017-01-03 16:37:23 +01:00
|
|
|
when: evolinux_hostname_hosts
|
2016-11-07 14:00:57 +01:00
|
|
|
|
|
|
|
- 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'
|
2017-01-03 16:37:23 +01:00
|
|
|
when: evolinux_hostname_hosts
|
2016-11-07 14:00:57 +01:00
|
|
|
|
|
|
|
- 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
|
2017-01-03 16:37:23 +01:00
|
|
|
when: evolinux_hostname_hosts
|
2016-11-07 14:00:57 +01:00
|
|
|
|
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
|
2017-01-03 16:37:23 +01:00
|
|
|
when: evolinux_hostname_mailname
|
2016-12-30 10:40:44 +01:00
|
|
|
|
2017-01-03 16:37:23 +01:00
|
|
|
# Override facts
|
|
|
|
|
|
|
|
- name: Override ansible_hostname fact
|
2016-11-07 14:00:57 +01:00
|
|
|
set_fact:
|
|
|
|
ansible_hostname: "{{ evolinux_hostname }}"
|
|
|
|
when: ansible_hostname != evolinux_hostname
|
|
|
|
|
2017-01-03 16:37:23 +01:00
|
|
|
- name: Override ansible_domain fact
|
2016-11-07 14:00:57 +01:00
|
|
|
set_fact:
|
|
|
|
ansible_domain: "{{ evolinux_domain }}"
|
|
|
|
when: ansible_domain != evolinux_domain
|
|
|
|
|
2017-01-03 16:37:23 +01:00
|
|
|
- name: Override ansible_fqdn fact
|
2016-11-07 14:00:57 +01:00
|
|
|
set_fact:
|
|
|
|
ansible_fqdn: "{{ evolinux_fqdn }}"
|
|
|
|
when: ansible_fqdn != evolinux_fqdn
|
2017-01-03 17:02:23 +01:00
|
|
|
|
|
|
|
- meta: flush_handlers
|