Обновить playbooks/diagnose.yml
This commit is contained in:
+21
-23
@@ -1,31 +1,29 @@
|
|||||||
---
|
---
|
||||||
- name: Diagnose and fix SSH on localhost
|
- name: Probe k8s access from AWX
|
||||||
hosts: localhost
|
hosts: localhost
|
||||||
become: yes
|
connection: local
|
||||||
|
gather_facts: no
|
||||||
tasks:
|
tasks:
|
||||||
- name: Check sshd service status
|
- name: Locate kubectl
|
||||||
ansible.builtin.command: systemctl status sshd --no-pager
|
ansible.builtin.shell: |
|
||||||
register: sshd_status
|
which kubectl || ls -la /usr/local/bin/kubectl /usr/bin/kubectl 2>/dev/null
|
||||||
|
register: k
|
||||||
ignore_errors: yes
|
ignore_errors: yes
|
||||||
|
|
||||||
- name: Show sshd status
|
- ansible.builtin.debug: { var: k.stdout_lines }
|
||||||
ansible.builtin.debug:
|
|
||||||
var: sshd_status.stdout_lines
|
|
||||||
|
|
||||||
- name: Check listening ports
|
- name: Try API access
|
||||||
ansible.builtin.shell: ss -tlnp | grep -E ':22|:2222'
|
ansible.builtin.shell: |
|
||||||
register: ports
|
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
|
ignore_errors: yes
|
||||||
|
|
||||||
- name: Show ports
|
- ansible.builtin.debug: { var: api.stdout_lines }
|
||||||
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
|
|
||||||
Reference in New Issue
Block a user