aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fischer@muhq.space>2022-06-26 17:06:35 +0200
committerFlorian Fischer <florian.fischer@muhq.space>2022-06-26 17:06:35 +0200
commit3654a0dc3dbdfd917cfaa43b4ca2a964a3dbb87c (patch)
tree5c0e0615cd61a9fbfad7827f5e1a4407a092cbf7
parent1c8d50308ef875fcb0b0a89e79228d5c1ae2f898 (diff)
downloadsshd_disable_passwd_login-3654a0dc3dbdfd917cfaa43b4ca2a964a3dbb87c.tar.gz
sshd_disable_passwd_login-3654a0dc3dbdfd917cfaa43b4ca2a964a3dbb87c.zip
use a toplevel block to tag all tasks with 'ssh'
-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