1
0
Fork 0
mirror of https://github.com/roles-ansible/ansible_role_sshd.git synced 2024-08-16 11:59:49 +02:00

Add ssh group variable

This commit is contained in:
Lilian Roller 2019-03-27 15:16:55 +01:00
parent d03df1994d
commit 2e1db1e216
No known key found for this signature in database
GPG key ID: 5215C3441797AB2B
2 changed files with 7 additions and 3 deletions

View file

@ -4,5 +4,11 @@ sshd_default_allowed_users:
- "root" - "root"
- "ansible" - "ansible"
# don't forget to add the ssh_access group!
sshd_default_allowed_groups:
- "root"
- "admins"
# Enable AllowUsers and AllowGroups options # Enable AllowUsers and AllowGroups options
restrict_allow_users: True restrict_allow_users: True

View file

@ -12,12 +12,10 @@
- ansible_distribution == 'Fedora' - ansible_distribution == 'Fedora'
- ansible_distribution == 'Archlinux' - ansible_distribution == 'Archlinux'
- name: Collect all users and groups allowed to login via ssh - name: Collect all users and groups allowed to login via ssh
set_fact: set_fact:
sshd_allow_users: '{{ sshd_default_allowed_users + users.keys() | default({}) | sort }}' sshd_allow_users: '{{ sshd_default_allowed_users + users.keys() | default({}) | sort }}'
sshd_allow_groups: '{{ ["root", "admins"] + users.keys() | default({}) | sort }}' sshd_allow_groups: '{{ sshd_default_allowed_groups + users.keys() | default({}) | sort }}'
- name: Copy sshd configuration - name: Copy sshd configuration
become: yes become: yes