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:
|
stat:
|
||||||
path: /etc/cloud/cloud.cfg
|
path: /etc/cloud/cloud.cfg
|
||||||
register: U18_server
|
register: U18_server
|
||||||
|
|
||||||
- name: Edit cloud.cfg yaml
|
- name: Put 'preserve_hostname: true' in /etc/cloud/cloud.cfg (ubuntu-18 server)
|
||||||
lineinfile:
|
lineinfile:
|
||||||
dest: /etc/cloud/cloud.cfg
|
path: /etc/cloud/cloud.cfg
|
||||||
regexp: '^preserve_hostname*'
|
regexp: '^preserve_hostname*'
|
||||||
line: 'preserve_hostname: true'
|
line: 'preserve_hostname: true'
|
||||||
state: present
|
state: present
|
||||||
when: U18_server is defined and U18_server.stat.exists
|
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 }}"
|
shell: hostnamectl set-hostname "{{ iiab_hostname }}.{{ iiab_domain }}"
|
||||||
when: is_debuntu
|
when: is_debuntu
|
||||||
|
|
||||||
- name: Configure /etc/sysconfig/network (redhat)
|
- name: Install /etc/sysconfig/network from template (redhat)
|
||||||
template:
|
template:
|
||||||
src: roles/network/templates/network/sysconfig.network.j2
|
src: roles/network/templates/network/sysconfig.network.j2
|
||||||
dest: /etc/sysconfig/network
|
dest: /etc/sysconfig/network
|
||||||
|
@ -24,9 +24,9 @@
|
||||||
mode: 0644
|
mode: 0644
|
||||||
when: is_redhat
|
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:
|
lineinfile:
|
||||||
dest: /etc/hosts
|
path: /etc/hosts
|
||||||
regexp: '^127\.0\.0\.1'
|
regexp: '^127\.0\.0\.1'
|
||||||
line: '127.0.0.1 localhost.localdomain localhost box {{ iiab_hostname }}'
|
line: '127.0.0.1 localhost.localdomain localhost box {{ iiab_hostname }}'
|
||||||
owner: root
|
owner: root
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue