1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-13 11:42:08 +00:00
iiab/roles/0-init/tasks/hostname.yml

43 lines
1.4 KiB
YAML
Raw Normal View History

2018-11-02 22:29:55 +00:00
- name: Does /etc/cloud/cloud.cfg exist i.e. is this ubuntu-18 server?
stat:
path: /etc/cloud/cloud.cfg
2018-05-17 19:42:36 +00:00
register: U18_server
2018-11-03 02:04:53 +00:00
- name: 'Put "preserve_hostname: true" in /etc/cloud/cloud.cfg (ubuntu-18 server)'
lineinfile:
2018-11-02 22:29:55 +00:00
path: /etc/cloud/cloud.cfg
regexp: '^preserve_hostname*'
line: 'preserve_hostname: true'
state: present
when: U18_server is defined and U18_server.stat.exists
2018-11-02 22:29:55 +00:00
- name: 'Turn the crank for systemd: hostnamectl set-hostname "{{ iiab_hostname }}.{{ iiab_domain }}" (debuntu)'
shell: hostnamectl set-hostname "{{ iiab_hostname }}.{{ iiab_domain }}"
when: is_debuntu
2018-11-02 22:29:55 +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
2018-11-02 22:29:55 +00:00
- name: Put hostnames "127.0.0.1 localhost.localdomain localhost box {{ iiab_hostname }}" in /etc/hosts
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'
line: '127.0.0.1 localhost.localdomain localhost box {{ iiab_hostname }}'
owner: root
group: root
mode: 0644
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