16 lines
455 B
YAML
16 lines
455 B
YAML
---
|
|
|
|
- name: Ensure sshd config options set correctly
|
|
lineinfile:
|
|
path: /etc/ssh/sshd_config
|
|
regexp: "^#?{{ item.key }} .*$"
|
|
line: "{{ item.key }} {{ item.value }}"
|
|
state: present
|
|
validate: '/usr/sbin/sshd -t -f %s'
|
|
notify: restart ssh
|
|
with_dict:
|
|
PermitRootLogin: 'prohibit-password'
|
|
PasswordAuthentication: "{{ 'yes' if sshd_password_auth else 'no' }}"
|
|
X11Forwarding: "{{ 'yes' if sshd_x11_forwarding else 'no' }}"
|
|
|