aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tasks/main.yml22
1 files changed, 12 insertions, 10 deletions
diff --git a/tasks/main.yml b/tasks/main.yml
index 8b6afb1..264679a 100644
--- a/tasks/main.yml
+++ b/tasks/main.yml
@@ -1,16 +1,18 @@
---
- name: Disable PasswordAuthentication
- lineinfile:
- path: /etc/ssh/sshd_config
- regexp: "^[#]?\\s?PasswordAuthentication"
- line: "PasswordAuthentication no"
tags:
- ssh
- register: disable_passwds
+ block:
+ - name: Disable PasswordAuthentication in sshd config
+ lineinfile:
+ path: /etc/ssh/sshd_config
+ regexp: "^[#]?\\s?PasswordAuthentication"
+ line: "PasswordAuthentication no"
+ register: disable_passwds
-- name: Restart service sshd
- when: disable_passwds.changed
- ansible.builtin.service:
- name: sshd
- state: restarted
+ - name: Restart service sshd
+ when: disable_passwds.changed
+ ansible.builtin.service:
+ name: sshd
+ state: restarted