2024-09-23 12:30:38 +00:00
|
|
|
# https://docs.ansible.com/ansible/latest/collections/ansible/builtin/hostname_module.html#ansible-collections-ansible-builtin-hostname-module
|
|
|
|
|
|
|
|
- name: Set the hostname in /etc/hostname
|
|
|
|
ansible.builtin.hostname:
|
|
|
|
name: "{{ hostname }}"
|
|
|
|
use: debian
|
|
|
|
- name: Replace /etc/hosts
|
|
|
|
template:
|
|
|
|
src: hosts.j2
|
2024-09-24 08:37:09 +00:00
|
|
|
dest: /etc/hosts
|
2024-09-23 12:30:38 +00:00
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: '0644'
|
|
|
|
backup: true
|
|
|
|
- name: Replace /etc/resolv.conf
|
|
|
|
template:
|
|
|
|
src: resolv.j2
|
2024-09-24 08:37:09 +00:00
|
|
|
dest: /etc/resolv.conf
|
2024-09-23 12:30:38 +00:00
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: '0644'
|
|
|
|
backup: true
|
|
|
|
when: resolv_enabled
|