ssh: Ensure ssh enabled, use ssh.service unit on debian

This commit is contained in:
uumas
2026-08-02 00:10:15 +03:00
parent a1e6c03827
commit 1afc3338b1
3 changed files with 10 additions and 3 deletions

View File

@@ -6,8 +6,13 @@
line: "{{ item.key }} {{ item.value }}"
state: present
validate: '/usr/sbin/sshd -t -f %s'
notify: Restart sshd
notify: Restart ssh service
with_dict:
PermitRootLogin: "prohibit-password"
PasswordAuthentication: "{{ 'yes' if ssh_password_auth else 'no' }}"
X11Forwarding: "no"
- name: Ensure ssh service is enabled
ansible.builtin.systemd_service:
name: "{{ _ssh_service_name }}"
enabled: true