Files
grinminer.net/ansible/ssh-softening.yml
2025-08-11 18:08:06 -07:00

26 lines
698 B
YAML

- hosts: all
remote_user: root
tasks:
- name: Replace PermitRootLogin
ansible.builtin.replace:
path: /etc/ssh/sshd_config
regexp: 'PermitRootLogin prohibit-password'
replace: 'PermitRootLogin yes'
- name: Replace PasswordAuthentication
ansible.builtin.replace:
path: /etc/ssh/sshd_config
regexp: 'PasswordAuthentication no'
replace: 'PasswordAuthentication yes'
- name: Replace PasswordAuthentication
ansible.builtin.replace:
path: /etc/ssh/sshd_config
regexp: '#PasswordAuthentication no'
replace: 'PasswordAuthentication yes'
- name: Restart SSH
ansible.builtin.shell:
cmd: systemctl restart ssh