2024-09-19 23:10:00 +02:00
|
|
|
---
|
|
|
|
- name: Set a hostname
|
|
|
|
ansible.builtin.hostname:
|
|
|
|
name: "{{ host.hostname }}"
|
|
|
|
become: true
|
|
|
|
|
|
|
|
- name: Update /etc/hosts to reflect the new hostname
|
2024-10-08 04:13:38 +02:00
|
|
|
ansible.builtin.lineinfile:
|
2024-09-19 23:10:00 +02:00
|
|
|
path: /etc/hosts
|
|
|
|
regexp: '^127\.0\.1\.1'
|
|
|
|
line: "127.0.1.1 {{ host.hostname }}"
|
|
|
|
state: present
|
2024-10-08 04:13:38 +02:00
|
|
|
backup: true
|
2024-09-19 23:10:00 +02:00
|
|
|
become: true
|