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
+43 -4
View File
@@ -1,4 +1,4 @@
#code: language=ansible
# code: language=ansible
- name: Disable link local addressing
ansible.builtin.lineinfile:
@@ -26,7 +26,7 @@
[Link]
ActivationPolicy=always-up
RequiredForOnline=yes
RequiredFamilyForOnline=both
RequiredFamilyForOnline={{ sshd_required_family_for_online }}
create: false
group: root
insertbefore: '^\[Network\]\s*$'
@@ -69,7 +69,23 @@
notify:
- Restart sshd
- name: Configure sshd_config
- name: Add an ssh group
ansible.builtin.group:
local: false
name: ssh
state: present
system: true
- name: Add user to ssh group
ansible.builtin.user:
append: true
groups:
- ssh
local: false
name: "{{ sshd_user }}"
state: present
- name: Configure sshd_config (IPv4)
ansible.builtin.lineinfile:
backrefs: false
create: true
@@ -82,7 +98,28 @@
path: "/etc/ssh/sshd_config"
regexp: "{{ item.pattern }}"
state: present
loop: "{{ sshd_config_lines }}"
loop: "{{ sshd_ipv4_config_lines }}"
loop_control:
label: "{{ item.label }}"
notify:
- Restart sshd
- name: Configure sshd_config (IPv6)
when:
- not (ipv4_only | default(false))
ansible.builtin.lineinfile:
backrefs: false
create: true
encoding: "utf-8"
firstmatch: false
group: root
line: "{{ item.line }}"
mode: "0664"
owner: root
path: "/etc/ssh/sshd_config"
regexp: "{{ item.pattern }}"
state: present
loop: "{{ sshd_ipv6_config_lines }}"
loop_control:
label: "{{ item.label }}"
notify:
@@ -110,6 +147,8 @@
label: "{{ item.comment }}"
- name: Configure UFW IPv6 rules
when:
- not (ipv4_only | default(false))
community.general.ufw:
comment: "{{ item.comment }}"
direction: "in"