You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

67 lines
1.8 KiB

  1. ---
  2. - hosts: all
  3. become: true
  4. gather_facts: no
  5. vars:
  6. debug: false
  7. commands:
  8. - name: timedate_info
  9. cmd: timedatectl status
  10. - name: kernel_info
  11. cmd: uname -r
  12. - name: docker_info
  13. cmd: docker info
  14. - name: ip_info
  15. cmd: ip -4 -o a
  16. - name: route_info
  17. cmd: ip ro
  18. - name: proc_info
  19. cmd: ps auxf | grep -v ]$
  20. - name: systemctl_failed_info
  21. cmd: systemctl --state=failed --no-pager
  22. - name: k8s_info
  23. cmd: kubectl get all --all-namespaces -o wide
  24. - name: errors_info
  25. cmd: journalctl -p err --utc --no-pager
  26. - name: etcd_info
  27. cmd: etcdctl --debug cluster-health
  28. logs:
  29. - /var/log/syslog
  30. - /var/log/daemon.log
  31. - /var/log/kern.log
  32. - /var/log/dpkg.log
  33. - /var/log/apt/history.log
  34. - /var/log/yum.log
  35. - /var/log/calico/bird/current
  36. - /var/log/calico/bird6/current
  37. - /var/log/calico/felix/current
  38. - /var/log/calico/confd/current
  39. tasks:
  40. - name: Storing commands output
  41. shell: "{{ item.cmd }} 2>&1 | tee {{ item.name }}"
  42. register: output
  43. ignore_errors: true
  44. with_items: "{{commands}}"
  45. - debug: var=item
  46. with_items: "{{output.results}}"
  47. when: debug
  48. - name: Fetch results
  49. fetch: src={{ item.name }} dest=/tmp/collect-info/commands
  50. with_items: "{{commands}}"
  51. - name: Fetch logs
  52. fetch: src={{ item }} dest=/tmp/collect-info/logs
  53. with_items: "{{logs}}"
  54. - name: Pack results and logs
  55. local_action: shell GZIP=-9 tar --remove-files -cvzf logs.tar.gz -C /tmp collect-info
  56. run_once: true
  57. - name: Clean up collected command outputs
  58. file: path={{ item.name }} state=absent
  59. with_items: "{{commands}}"