role.ssh-keyonly/tasks/main.yml

16 lines
295 B
YAML

---
- name: "Set «PermitRootLogin» to «without-password»"
lineinfile:
dest: /etc/ssh/sshd_config
regexp: '^#* *PermitRootLogin'
line: "PermitRootLogin without-password"
backup: yes
- name: Restart sshd
service:
name: "{{ ssh_service_name }}"
state: restarted