evolinux-users: deal with AllowGroups and AllowUsers differently

This commit is contained in:
Jérémy Lecour 2018-02-08 15:29:53 +01:00 committed by Jérémy Lecour
parent 6cb1a5765a
commit c18b83d974

View file

@ -26,7 +26,20 @@
loop_var: ssk_key
when: user.ssh_keys is defined
# we must double-escape caracters, because python
- name: verify AllowGroups directive
shell: "grep -E '^AllowGroups' /etc/ssh/sshd_config"
changed_when: False
failed_when: False
register: grep_allowgroups_ssh
check_mode: no
# If AllowGroups is present, we don't change
- debug:
msg: "AllowGroups detected : You have to configure SSH manually"
when: grep_allowgroups_ssh.rc == 0
- block:
# If AllowGroups is not present, we proceed as usual
- name: verify AllowUsers directive
shell: "grep -E '^AllowUsers' /etc/ssh/sshd_config"
changed_when: False
@ -80,3 +93,5 @@
when:
- ansible_distribution_release == "jessie"
- grep_matchuser_ssh.rc == 0
when: grep_allowgroups_ssh.rc != 0