--- - name: Включение root доступа по SSH hosts: all become: yes gather_facts: yes tasks: - name: Разрешить root логин через SSH ansible.builtin.lineinfile: path: /etc/ssh/sshd_config regexp: '^#?PermitRootLogin' line: 'PermitRootLogin yes' backup: yes notify: Restart SSH - name: Разрешить аутентификацию по паролю для root (если нужно) ansible.builtin.lineinfile: path: /etc/ssh/sshd_config regexp: '^#?PasswordAuthentication' line: 'PasswordAuthentication yes' notify: Restart SSH - name: Убедиться, что SSH сервис запущен ansible.builtin.systemd: name: ssh state: started enabled: yes handlers: - name: Restart SSH ansible.builtin.systemd: name: ssh state: restarted