1
0
Fork 0
home-ansible/roles/ssh/tasks/main.yml

14 lines
388 B
YAML

---
- name: Block root and password authentication
lineinfile:
path: /etc/ssh/sshd_config
regexp: '{{ item.regexp }}'
line: '{{ item.line }}'
validate: 'sshd -T -f %s'
state: present
with_items:
- regexp: '^PasswordAuthentication'
line: 'PasswordAuthentication no'
- regexp: '^#PermitRootLogin'
line: 'PermitRootLogin no'
notify: Restart ssh