vn-ansible/roles/linux-hostname/tasks/main.yml

24 lines
585 B
YAML
Raw Normal View History

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
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