Sudoers config and hostname config working

This commit is contained in:
2026-09-09 16:50:19 -04:00
parent 18233ebf74
commit 7090ea5585
9 changed files with 184 additions and 19 deletions
+23
View File
@@ -0,0 +1,23 @@
# code: language=ansible
- name: Add IPv4 address to /etc/hosts
ansible.builtin.lineinfile:
path: /etc/hosts
line: "{{ ipv4_address }} {{ inventory_hostname }} {{ inventory_hostname_short }}"
- name: Ensure IPv4 loopback exists in /etc/hosts
ansible.builtin.lineinfile:
path: /etc/hosts
line: "127.0.1.1 {{ inventory_hostname }} {{ inventory_hostname_short }}"
- name: Add IPv6 address to /etc/hosts
when:
- not (ipv4_only | default(false))
ansible.builtin.lineinfile:
path: /etc/hosts
line: "{{ ipv6_address }} {{ inventory_hostname }} {{ inventory_hostname_short }}"
- name: Set hostname
ansible.builtin.hostname:
name: "{{ inventory_hostname }}"
use: systemd