evolinux-users: deal with AllowGroups and AllowUsers differently
This commit is contained in:
parent
6cb1a5765a
commit
c18b83d974
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue