Added proper set hostname
parent
e189517d27
commit
2da928a24b
|
@ -0,0 +1,8 @@
|
|||
---
|
||||
- name: update hosts
|
||||
template:
|
||||
src: hosts.j2
|
||||
dest: /etc/hosts
|
||||
owner: root
|
||||
group: root
|
||||
mode: 644
|
|
@ -0,0 +1,5 @@
|
|||
127.0.0.1 localhost {{ hostname }}
|
||||
|
||||
::1 localhost ip6-localhost ip6-loopback
|
||||
ff02::1 ip6-allnodes
|
||||
ff02::2 ip6-allrouters
|
|
@ -1,5 +1,17 @@
|
|||
---
|
||||
- name: Check current hostname
|
||||
register: cur_hostname
|
||||
shell: hostname
|
||||
changed_when: false
|
||||
|
||||
- name: yeet
|
||||
debug:
|
||||
msg: "{{ cur_hostname }} - {{ hostname }}"
|
||||
|
||||
- name: Set hostname
|
||||
hostname:
|
||||
name: "{{ hostname }}"
|
||||
use: debian
|
||||
shell: "hostnamectl set-hostname {{ hostname }}"
|
||||
# hostname:
|
||||
# name: "{{ hostname }}"
|
||||
# use: debian
|
||||
notify: update hosts
|
||||
when: cur_hostname.stdout != hostname
|
||||
|
|
Loading…
Reference in New Issue