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
2018-07-09 02:15:32 -04:00

42 lines
1.2 KiB
YAML

- name: Is ubuntu-18 server
stat:
path: /etc/cloud/cloud.cfg
register: U18_server
- name: Edit cloud.cfg yaml
lineinfile:
dest: /etc/cloud/cloud.cfg
regexp: '^preserve_hostname*'
line: 'preserve_hostname: true'
state: present
when: U18_server is defined and U18_server.stat.exists
- name: Turn the crank for systemd (debuntu)
shell: hostnamectl set-hostname "{{ iiab_hostname }}.{{ iiab_domain }}"
when: is_debuntu
- name: Configure /etc/sysconfig/network (redhat)
template:
src: roles/network/templates/network/sysconfig.network.j2
dest: /etc/sysconfig/network
owner: root
group: root
mode: 0644
when: is_redhat
- name: Configure short hostname in /etc/hosts
lineinfile:
dest: /etc/hosts
regexp: '^127\.0\.0\.1'
line: '127.0.0.1 localhost.localdomain localhost box {{ iiab_hostname }}'
owner: root
group: root
mode: 0644
#- name: Re-configuring httpd - not initial install
# include_tasks: roles/httpd/tasks/main.yml
# when: iiab_stage|int > 3
#- name: Re-configuring rest of networking - not initial install
# include_tasks: roles/network/tasks/main.yml
# when: iiab_stage|int > 4