diff --git a/roles/sshd/tasks/main.yml b/roles/sshd/tasks/main.yml index d35222a..ab6d06d 100644 --- a/roles/sshd/tasks/main.yml +++ b/roles/sshd/tasks/main.yml @@ -21,3 +21,12 @@ 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