1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-03-09 15:40:17 +00:00

Update hostname.yml

This commit is contained in:
A Holt 2018-11-02 18:29:55 -04:00 committed by GitHub
parent 9dcdb74915
commit 2af06529ea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,21 +1,21 @@
- name: Is ubuntu-18 server
- name: Does /etc/cloud/cloud.cfg exist i.e. is this ubuntu-18 server?
stat:
path: /etc/cloud/cloud.cfg
register: U18_server
- name: Edit cloud.cfg yaml
- name: Put 'preserve_hostname: true' in /etc/cloud/cloud.cfg (ubuntu-18 server)
lineinfile:
dest: /etc/cloud/cloud.cfg
path: /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)
- 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
- name: Configure /etc/sysconfig/network (redhat)
- name: Install /etc/sysconfig/network from template (redhat)
template:
src: roles/network/templates/network/sysconfig.network.j2
dest: /etc/sysconfig/network
@ -24,9 +24,9 @@
mode: 0644
when: is_redhat
- name: Configure short hostname in /etc/hosts
- name: Put hostnames "127.0.0.1 localhost.localdomain localhost box {{ iiab_hostname }}" in /etc/hosts
lineinfile:
dest: /etc/hosts
path: /etc/hosts
regexp: '^127\.0\.0\.1'
line: '127.0.0.1 localhost.localdomain localhost box {{ iiab_hostname }}'
owner: root