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

18 lines
367 B
YAML
Raw Normal View History

2021-12-11 16:28:17 +01:00
---
2021-12-11 18:00:19 +01:00
- name: Check current hostname
register: cur_hostname
shell: hostname
changed_when: false
- name: yeet
debug:
msg: "{{ cur_hostname }} - {{ hostname }}"
2021-12-11 16:28:17 +01:00
- name: Set hostname
2021-12-11 18:00:19 +01:00
shell: "hostnamectl set-hostname {{ hostname }}"
# hostname:
# name: "{{ hostname }}"
# use: debian
notify: update hosts
when: cur_hostname.stdout != hostname