diff options
Diffstat (limited to 'tasks/main.yml')
| -rw-r--r-- | tasks/main.yml | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/tasks/main.yml b/tasks/main.yml index 7735f17..4137d8c 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,9 +1,16 @@ --- - name: Disable PasswordAuthentication lineinfile: - path: /etc/ssh/sshdd_config - regexp: "^[#]? PasswordAuthentication" + path: /etc/ssh/sshd_config + regexp: "^[#]?\\s?PasswordAuthentication" line: "PasswordAuthentication no" tags: - ssh + register: disable_passwds + +- name: Restart service sshd + when: disable_passwds.changed + ansible.builtin.service: + name: sshd + state: restarted |
