Add support for AllowGroups

This commit is contained in:
Alexander Gorelyshev
2026-05-18 21:05:16 +04:00
parent dfa5ae3a19
commit 1d0676f71b
2 changed files with 21 additions and 9 deletions

View File

@@ -14,6 +14,9 @@
- name: "Configure additional restrictions"
ansible.builtin.include_tasks: "restrictions.yml"
- name: "Configure whitelists"
ansible.builtin.include_tasks: "whitelists.yml"
- name: "Log at VERBOSE level"
notify: Restart sshd
ansible.builtin.lineinfile:
@@ -21,12 +24,3 @@
regexp: '^#?LogLevel'
line: 'LogLevel VERBOSE'
validate: sshd -f %s -t
- name: "Configure AllowUsers"
when: sshd_allow_users is defined
notify: Restart sshd
ansible.builtin.lineinfile:
path: /etc/ssh/sshd_config
regexp: '^#?\s*AllowUsers\s+'
line: "AllowUsers {{ sshd_allow_users }}"
validate: sshd -f %s -t

View File

@@ -0,0 +1,18 @@
---
- name: "Configure AllowUsers"
when: sshd_allow_users is defined
notify: Restart sshd
ansible.builtin.lineinfile:
path: /etc/ssh/sshd_config
regexp: '^#?\s*AllowUsers\s+'
line: "AllowUsers {{ sshd_allow_users }}"
validate: sshd -f %s -t
- name: "Configure AllowGroups"
when: sshd_allow_groups is defined
notify: Restart sshd
ansible.builtin.lineinfile:
path: /etc/ssh/sshd_config
regexp: '^#?\s*AllowGroups\s+'
line: "AllowGroups {{ sshd_allow_groups }}"
validate: sshd -f %s -t