From 4e00af379467893fd86c59015c65564cdbc4ff94 Mon Sep 17 00:00:00 2001 From: administrator Date: Sun, 27 Sep 2026 20:06:15 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D1=82?= =?UTF-8?q?=D1=8C=20playbooks/diagnose.yml?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- playbooks/diagnose.yml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 playbooks/diagnose.yml diff --git a/playbooks/diagnose.yml b/playbooks/diagnose.yml new file mode 100644 index 0000000..69d0998 --- /dev/null +++ b/playbooks/diagnose.yml @@ -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 \ No newline at end of file