Files
ansible/roles/xray-vps-setup/tasks/ssh.yml
Gabenov Stanislav a6d2623802 vpn
2026-02-09 20:42:24 +03:00

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