From 8435ac192d0a2df354b1aba2d0835af8236740f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Lecour?= Date: Tue, 10 Oct 2017 22:01:12 +0200 Subject: [PATCH] evolinux-users: better detection of AllowUsers --- evolinux-users/tasks/main.yml | 3 ++- evolinux-users/tasks/ssh.yml | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/evolinux-users/tasks/main.yml b/evolinux-users/tasks/main.yml index f168ae08..b28dd377 100644 --- a/evolinux-users/tasks/main.yml +++ b/evolinux-users/tasks/main.yml @@ -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 }}" diff --git a/evolinux-users/tasks/ssh.yml b/evolinux-users/tasks/ssh.yml index 4bf9e5dc..519c53ee 100644 --- a/evolinux-users/tasks/ssh.yml +++ b/evolinux-users/tasks/ssh.yml @@ -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