14 lines
525 B
YAML
14 lines
525 B
YAML
- name: Change SSH port
|
|
shell:
|
|
cmd: grep -r Port /etc/ssh -l | xargs -n 1 sed -i -e "/Port /c\Port {{ SSH_PORT }}"
|
|
- name: Disable password login
|
|
shell:
|
|
cmd: grep -r PasswordAuthentication /etc/ssh -l | xargs -n 1 sed -i -e "/PasswordAuthentication /c\PasswordAuthentication no"
|
|
- name: Disable root login
|
|
shell:
|
|
cmd: grep -r PermitRootLogin /etc/ssh -l | xargs -n 1 sed -i -e "/PermitRootLogin /c\PermitRootLogin no"
|
|
- name: Restart ssh
|
|
service:
|
|
name: ssh
|
|
state: restarted
|
|
daemon_reload: true |