24 lines
581 B
YAML
24 lines
581 B
YAML
# 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
|
|
dest: /etc/hosts
|
|
owner: root
|
|
group: root
|
|
mode: '0644'
|
|
backup: true
|
|
- name: Replace /etc/resolv.conf
|
|
template:
|
|
src: resolv.j2
|
|
dest: /etc/resolv.conf
|
|
owner: root
|
|
group: root
|
|
mode: '0644'
|
|
backup: true
|
|
when: resolv_enabled
|