Обновить 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
|
||||
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
|
||||
- ansible.builtin.debug: { var: api.stdout_lines }
|
||||
Reference in New Issue
Block a user