diff options
| author | Ahmed Abdelhalim <[email protected]> | 2025-08-11 00:32:08 +0200 |
|---|---|---|
| committer | Ahmed Abdelhalim <[email protected]> | 2025-08-11 00:32:08 +0200 |
| commit | 4a0b46929b130bd539c052db359b351716bf9dd3 (patch) | |
| tree | cbca6923b72fd01a83621d283912d4116cd57b25 /roles/hostname/tasks | |
| parent | 077c7721695f01f3daf9d8b702a2f819067e0d07 (diff) | |
Refactor: move hostname into its own role
Diffstat (limited to 'roles/hostname/tasks')
| -rw-r--r-- | roles/hostname/tasks/main.yml | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/roles/hostname/tasks/main.yml b/roles/hostname/tasks/main.yml new file mode 100644 index 00000000..b6dc2cc1 --- /dev/null +++ b/roles/hostname/tasks/main.yml @@ -0,0 +1,22 @@ +--- +- name: "Configure /etc/hostname" + become: true + ansible.builtin.copy: + dest: "/etc/hostname" + mode: "0644" + content: | + {{ hostname }} + when: hostname is defined + +- name: "Configure /etc/hosts" + become: true + ansible.builtin.copy: + dest: "/etc/hosts" + mode: "0644" + content: | + 127.0.0.1 localhost + 127.0.1.1 {{ hostname }} + ::1 localhost ip6-localhost ip6-loopback + ff02::1 ip6-allnodes + ff02::2 ip6-allrouters + when: hostname is defined |
