Skip to content

Commit 9a440c8

Browse files
Add default ssh settings, ignore key errors in check mode
1 parent 9afe057 commit 9a440c8

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

defaults/main.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ system:
55
{%- else -%}
66
wheel
77
{%- endif -%}
8+
sshd:
9+
config:
10+
PasswordAuthentication: no
11+
PermitRootLogin: no
812
features:
913
sshd: no
1014
proserver_fact: no

tasks/authorized_keys.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
2424
- name: Add authorized keys
2525
loop: "{{ user_authorized_keys }}"
26+
failed_when: "{{ add_authorized_keys.failed and not ansible_check_mode }}"
27+
register: add_authorized_keys
2628
loop_control:
2729
label: '{{ item.user }} public_keys="{{ item.key }}"'
2830
ansible.posix.authorized_key:

0 commit comments

Comments
 (0)