deployment/roles/set-hostname/tasks/main.yml

18 lines
367 B
YAML

---
- name: Check current hostname
register: cur_hostname
shell: hostname
changed_when: false
- name: yeet
debug:
msg: "{{ cur_hostname }} - {{ hostname }}"
- name: Set hostname
shell: "hostnamectl set-hostname {{ hostname }}"
# hostname:
# name: "{{ hostname }}"
# use: debian
notify: update hosts
when: cur_hostname.stdout != hostname