2016-11-07 14:00:57 +01:00
|
|
|
---
|
2017-11-22 14:08:54 +01:00
|
|
|
- name: dbus is installed
|
2023-03-18 18:35:54 +01:00
|
|
|
ansible.builtin.apt:
|
2017-11-22 14:08:54 +01:00
|
|
|
name: dbus
|
2018-05-18 09:33:25 +02:00
|
|
|
state: present
|
2017-11-22 14:08:54 +01:00
|
|
|
|
2022-12-19 17:05:45 +01:00
|
|
|
- name: dbus is enabled and started
|
2023-03-18 18:35:54 +01:00
|
|
|
ansible.builtin.systemd:
|
2022-12-19 17:05:45 +01:00
|
|
|
name: dbus
|
|
|
|
state: started
|
|
|
|
enabled: true
|
|
|
|
|
2016-11-07 14:00:57 +01:00
|
|
|
- name: Set hostname "{{ evolinux_hostname }}"
|
2023-03-18 18:35:54 +01:00
|
|
|
ansible.builtin.hostname:
|
2016-11-07 14:00:57 +01:00
|
|
|
name: "{{ evolinux_hostname }}"
|
2021-05-09 23:06:42 +02:00
|
|
|
when: evolinux_hostname_hosts | bool
|
2016-11-07 14:00:57 +01:00
|
|
|
|
|
|
|
- name: Set right localhost line in /etc/hosts
|
2023-03-18 18:35:54 +01:00
|
|
|
ansible.builtin.replace:
|
2016-11-07 14:00:57 +01:00
|
|
|
dest: /etc/hosts
|
|
|
|
regexp: '^127.0.0.1(\s+)localhost.*$'
|
|
|
|
replace: '127.0.0.1\1localhost.localdomain localhost'
|
2021-05-09 23:06:42 +02:00
|
|
|
when: evolinux_hostname_hosts | bool
|
2016-11-07 14:00:57 +01:00
|
|
|
|
|
|
|
- name: Set ip+fqdn+hostname in /etc/hosts
|
2023-03-18 18:35:54 +01:00
|
|
|
ansible.builtin.lineinfile:
|
2016-11-07 14:00:57 +01:00
|
|
|
dest: /etc/hosts
|
2016-12-27 16:45:46 +01:00
|
|
|
regexp: '^{{ ansible_default_ipv4.address }}\s+'
|
2018-08-17 10:07:36 +02:00
|
|
|
line: "{{ ansible_default_ipv4.address }} {{ [evolinux_fqdn, evolinux_internal_fqdn] | unique | join(' ') }} {{ [evolinux_hostname, evolinux_internal_hostname] | unique | join(' ') }}"
|
2016-11-07 14:00:57 +01:00
|
|
|
insertafter: '127.0.0.1\s+localhost.localdomain'
|
2021-05-09 23:06:42 +02:00
|
|
|
when: evolinux_hostname_hosts | bool
|
2016-11-07 14:00:57 +01:00
|
|
|
|
|
|
|
- name: 127.0.1.1 is removed
|
2023-03-18 18:35:54 +01:00
|
|
|
ansible.builtin.lineinfile:
|
2016-11-07 14:00:57 +01:00
|
|
|
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
|
2021-05-09 23:06:42 +02:00
|
|
|
when: evolinux_hostname_hosts | bool
|
2016-11-07 14:00:57 +01:00
|
|
|
|
2016-12-30 10:40:44 +01:00
|
|
|
- name: /etc/mailname is up-to-date
|
2023-03-18 18:35:54 +01:00
|
|
|
ansible.builtin.copy:
|
2016-12-30 10:40:44 +01:00
|
|
|
dest: /etc/mailname
|
|
|
|
content: "{{ evolinux_fqdn }}\n"
|
2023-06-28 13:22:59 +02:00
|
|
|
force: true
|
2021-05-09 23:06:42 +02:00
|
|
|
when: evolinux_hostname_mailname | bool
|
2016-12-30 10:40:44 +01:00
|
|
|
|
2017-01-03 16:37:23 +01:00
|
|
|
# Override facts
|
|
|
|
|
|
|
|
- name: Override ansible_hostname fact
|
2023-03-18 18:35:54 +01:00
|
|
|
ansible.builtin.set_fact:
|
2016-11-07 14:00:57 +01:00
|
|
|
ansible_hostname: "{{ evolinux_hostname }}"
|
|
|
|
when: ansible_hostname != evolinux_hostname
|
|
|
|
|
2017-01-03 16:37:23 +01:00
|
|
|
- name: Override ansible_domain fact
|
2023-03-18 18:35:54 +01:00
|
|
|
ansible.builtin.set_fact:
|
2016-11-07 14:00:57 +01:00
|
|
|
ansible_domain: "{{ evolinux_domain }}"
|
|
|
|
when: ansible_domain != evolinux_domain
|
|
|
|
|
2017-01-03 16:37:23 +01:00
|
|
|
- name: Override ansible_fqdn fact
|
2023-03-18 18:35:54 +01:00
|
|
|
ansible.builtin.set_fact:
|
2016-11-07 14:00:57 +01:00
|
|
|
ansible_fqdn: "{{ evolinux_fqdn }}"
|
|
|
|
when: ansible_fqdn != evolinux_fqdn
|
2017-01-03 17:02:23 +01:00
|
|
|
|
2023-03-18 18:35:54 +01:00
|
|
|
- ansible.builtin.meta: flush_handlers
|