Добавить playbooks/diagnose.yml

This commit is contained in:
2026-09-27 20:06:15 +03:00
parent 5855f2090c
commit 4e00af3794
+31
View File
@@ -0,0 +1,31 @@
---
- name: Diagnose and fix SSH on localhost
hosts: localhost
become: yes
tasks:
- name: Check sshd service status
ansible.builtin.command: systemctl status sshd --no-pager
register: sshd_status
ignore_errors: yes
- name: Show sshd status
ansible.builtin.debug:
var: sshd_status.stdout_lines
- name: Check listening ports
ansible.builtin.shell: ss -tlnp | grep -E ':22|:2222'
register: ports
ignore_errors: yes
- name: Show ports
ansible.builtin.debug:
var: ports.stdout_lines
- name: Test sshd configuration
ansible.builtin.command: sshd -t
register: sshd_test
ignore_errors: yes
- name: Show config test result
ansible.builtin.debug:
var: sshd_test.stderr