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.

68 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. no_log: True
  46. - debug: var=item
  47. with_items: "{{output.results}}"
  48. when: debug
  49. - name: Fetch results
  50. fetch: src={{ item.name }} dest=/tmp/collect-info/commands
  51. with_items: "{{commands}}"
  52. - name: Fetch logs
  53. fetch: src={{ item }} dest=/tmp/collect-info/logs
  54. with_items: "{{logs}}"
  55. - name: Pack results and logs
  56. local_action: shell GZIP=-9 tar --remove-files -cvzf logs.tar.gz -C /tmp collect-info
  57. run_once: true
  58. - name: Clean up collected command outputs
  59. file: path={{ item.name }} state=absent
  60. with_items: "{{commands}}"