From 5c3fbc79c0491a633b1b6d502451cac08a4f565b Mon Sep 17 00:00:00 2001 From: administrator Date: Sun, 27 Sep 2026 20:13:15 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9E=D0=B1=D0=BD=D0=BE=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 | 44 ++++++++++++++++++++---------------------- 1 file changed, 21 insertions(+), 23 deletions(-) diff --git a/playbooks/diagnose.yml b/playbooks/diagnose.yml index 69d0998..b29970c 100644 --- a/playbooks/diagnose.yml +++ b/playbooks/diagnose.yml @@ -1,31 +1,29 @@ --- -- name: Diagnose and fix SSH on localhost +- name: Probe k8s access from AWX hosts: localhost - become: yes + connection: local + gather_facts: no tasks: - - name: Check sshd service status - ansible.builtin.command: systemctl status sshd --no-pager - register: sshd_status + - name: Locate kubectl + ansible.builtin.shell: | + which kubectl || ls -la /usr/local/bin/kubectl /usr/bin/kubectl 2>/dev/null + register: k ignore_errors: yes - - name: Show sshd status - ansible.builtin.debug: - var: sshd_status.stdout_lines + - ansible.builtin.debug: { var: k.stdout_lines } - - name: Check listening ports - ansible.builtin.shell: ss -tlnp | grep -E ':22|:2222' - register: ports + - name: Try API access + ansible.builtin.shell: | + kubectl version --short 2>&1 + echo "---" + kubectl get nodes -o wide 2>&1 + echo "---" + kubectl get pods -A 2>&1 | head -30 + echo "---" + kubectl auth can-i create pods --all-namespaces 2>&1 + echo "---" + kubectl auth can-i create pods --all-namespaces -n default 2>&1 + register: api 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 + - ansible.builtin.debug: { var: api.stdout_lines } \ No newline at end of file