We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 440d6f5 commit 70d5d0cCopy full SHA for 70d5d0c
ansible/roles/sshd/tasks/configure.yml
@@ -1,3 +1,6 @@
1
+- name: Grab facts to determine distribution
2
+ setup:
3
+
4
- name: Template sshd configuration
5
# NB: If parameters are defined multiple times the first value wins;
6
# The default /etc/ssh/sshd_config has
@@ -13,3 +16,17 @@
13
16
validate: sshd -t -f %s
14
17
notify:
15
18
- Restart sshd
19
+ when: ansible_facts.distribution_major_version == '9'
20
21
+- name: Disallow SSH password authentication
22
+ lineinfile:
23
+ dest: /etc/ssh/sshd_config
24
+ regexp: "^PasswordAuthentication"
25
+ line: "PasswordAuthentication {{ 'yes' if sshd_password_authentication | bool else 'no' }}"
26
+ state: present
27
+ validate: sshd -t -f %s
28
+ notify:
29
+ - Restart sshd
30
+ become: true
31
+ when: ansible_facts.distribution_major_version == '8'
32
0 commit comments