Add a task for optionally configuring the AllowUsers directive
This commit is contained in:
@@ -21,3 +21,12 @@
|
|||||||
regexp: '^#?LogLevel'
|
regexp: '^#?LogLevel'
|
||||||
line: 'LogLevel VERBOSE'
|
line: 'LogLevel VERBOSE'
|
||||||
validate: sshd -f %s -t
|
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
|
||||||
|
|||||||
Reference in New Issue
Block a user