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:
parent
9dcdb74915
commit
2af06529ea
1 changed files with 7 additions and 7 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue