2021-07-30 08:01:12 +00:00
|
|
|
- name: Does /etc/cloud/cloud.cfg exist e.g. is this Ubuntu Server 18+ ?
|
2018-05-17 19:28:42 +00:00
|
|
|
stat:
|
|
|
|
path: /etc/cloud/cloud.cfg
|
2021-07-30 08:01:12 +00:00
|
|
|
register: cloudcfg_test
|
2018-05-17 19:28:42 +00:00
|
|
|
|
2021-07-30 08:01:12 +00:00
|
|
|
- name: "If so, ensure 'preserve_hostname: true' is in /etc/cloud/cloud.cfg"
|
2018-05-17 19:28:42 +00:00
|
|
|
lineinfile:
|
2018-11-02 22:29:55 +00:00
|
|
|
path: /etc/cloud/cloud.cfg
|
2018-05-17 19:28:42 +00:00
|
|
|
regexp: '^preserve_hostname*'
|
|
|
|
line: 'preserve_hostname: true'
|
|
|
|
state: present
|
2021-07-30 08:01:12 +00:00
|
|
|
when: cloudcfg_test.stat.exists
|
2018-05-17 19:28:42 +00:00
|
|
|
|
2021-08-31 04:11:53 +00:00
|
|
|
- name: 'Set /etc/hostname by running: hostnamectl set-hostname "{{ iiab_hostname }}"'
|
2021-08-31 04:04:36 +00:00
|
|
|
command: hostnamectl set-hostname "{{ iiab_hostname }}"
|
|
|
|
# 2021-08-31: Periods in /etc/hostname fail with some WiFi routers (#2904)
|
|
|
|
# command: hostnamectl set-hostname "{{ iiab_hostname }}.{{ iiab_domain }}"
|
2017-10-08 19:42:55 +00:00
|
|
|
|
2021-07-30 08:01:12 +00:00
|
|
|
#- name: Install /etc/sysconfig/network from template (redhat)
|
|
|
|
# template:
|
|
|
|
# src: roles/network/templates/network/sysconfig.network.j2
|
|
|
|
# dest: /etc/sysconfig/network
|
|
|
|
# owner: root
|
|
|
|
# group: root
|
|
|
|
# mode: 0644
|
|
|
|
# when: is_redhat
|
2017-11-05 19:40:19 +00:00
|
|
|
|
2019-12-11 06:25:33 +00:00
|
|
|
# roles/network/tasks/hosts.yml [no longer in use] ALSO did this:
|
2019-07-08 19:16:07 +00:00
|
|
|
- name: 'Put FQDN & hostnames in /etc/hosts: "127.0.0.1 {{ iiab_hostname }}.{{ iiab_domain }} localhost.localdomain localhost {{ iiab_hostname }} box box.lan"'
|
2018-02-13 00:50:40 +00:00
|
|
|
lineinfile:
|
2018-11-02 22:29:55 +00:00
|
|
|
path: /etc/hosts
|
2018-02-13 13:54:30 +00:00
|
|
|
regexp: '^127\.0\.0\.1'
|
2019-07-08 19:16:07 +00:00
|
|
|
line: '127.0.0.1 {{ iiab_hostname }}.{{ iiab_domain }} localhost.localdomain localhost {{ iiab_hostname }} box box.lan'
|
2021-07-30 08:01:12 +00:00
|
|
|
#owner: root
|
|
|
|
#group: root
|
|
|
|
#mode: 0644
|
2017-11-05 19:54:26 +00:00
|
|
|
|
2017-11-18 17:40:40 +00:00
|
|
|
#- name: Re-configuring httpd - not initial install
|
|
|
|
# include_tasks: roles/httpd/tasks/main.yml
|
|
|
|
# when: iiab_stage|int > 3
|
2017-11-05 21:11:14 +00:00
|
|
|
|
2017-11-13 02:52:02 +00:00
|
|
|
#- name: Re-configuring rest of networking - not initial install
|
|
|
|
# include_tasks: roles/network/tasks/main.yml
|
|
|
|
# when: iiab_stage|int > 4
|