evolinux-users: better detection of AllowUsers

This commit is contained in:
Jérémy Lecour 2017-10-10 22:01:12 +02:00
parent 707aabb404
commit 8435ac192d
2 changed files with 3 additions and 2 deletions

View file

@ -9,7 +9,8 @@
msg: "Warning: empty 'evolinux_users' variable, tasks will be skipped!"
when: evolinux_users == {}
- include: user.yml
- name: Create user accounts
include: user.yml
vars:
user: "{{ item.value }}"
with_dict: "{{ evolinux_users }}"

View file

@ -46,7 +46,7 @@
- name: "Modify AllowUsers sshd directive for '{{ user.name }}'"
replace:
dest: /etc/ssh/sshd_config
regexp: '^(AllowUsers ((?!{{ user.name }}).)*)$'
regexp: '^(AllowUsers ((?!\b{{ user.name }}\b).)*)$'
replace: '\1 {{ user.name }}'
validate: '/usr/sbin/sshd -T -f %s'
notify: reload sshd