diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2022-06-23 19:59:53 +0200 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2022-06-23 19:59:53 +0200 |
| commit | 78318852fb35f189d24c4b1335ba452a46733944 (patch) | |
| tree | e893ff2b590576f169a8e533bdfc808215fff5ab /tasks | |
| parent | e10d4b7945a60044dd1beb50a67188cb91c17ab4 (diff) | |
| download | sshd_disable_passwd_login-78318852fb35f189d24c4b1335ba452a46733944.tar.gz sshd_disable_passwd_login-78318852fb35f189d24c4b1335ba452a46733944.zip | |
fix regex and restart sshd
Diffstat (limited to 'tasks')
| -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 |
