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.

71 lines
1.9 KiB

  1. ---
  2. - hosts: all
  3. become: true
  4. gather_facts: no
  5. vars:
  6. debug: false
  7. commands:
  8. - name: git_info
  9. cmd: cat {kargo,.}/.git/logs/HEAD
  10. - name: timedate_info
  11. cmd: timedatectl status
  12. - name: boots_info
  13. cmd: journalctl --list-boots --utc --no-pager
  14. - name: space_info
  15. cmd: df -h
  16. - name: kernel_info
  17. cmd: uname -r
  18. - name: distro_info
  19. cmd: cat /etc/issue.net
  20. - name: docker_info
  21. cmd: docker info
  22. - name: ip_info
  23. cmd: ip -4 -o a
  24. - name: route_info
  25. cmd: ip ro
  26. - name: proc_info
  27. cmd: ps auxf | grep -v ]$
  28. - name: systemctl_info
  29. cmd: systemctl status
  30. - name: k8s_info
  31. cmd: kubectl get all --all-namespaces -o wide
  32. - name: k8s_dump_info
  33. cmd: kubectl get all --all-namespaces -o yaml
  34. - name: errors_info
  35. cmd: journalctl -p err --utc --no-pager
  36. logs:
  37. - /var/log/ansible.log
  38. - /var/log/ansible/ansible.log
  39. - /var/log/syslog
  40. - /var/log/daemon.log
  41. - /var/log/kern.log
  42. - inventory/inventory.ini
  43. - cluster.yml
  44. - kargo/kargo_default_ubuntu.yaml
  45. - kargo/kargo_default_debian.yaml
  46. - kargo/kargo_default_common.yaml
  47. - kargo/inventory/inventory.cfg
  48. tasks:
  49. - name: Storing commands output
  50. shell: "{{ item.cmd }} 2>&1 | tee {{ item.name }}"
  51. register: output
  52. ignore_errors: true
  53. with_items: "{{commands}}"
  54. - debug: var=item
  55. with_items: output.results
  56. when: debug
  57. - name: Fetch results
  58. fetch: src={{ item.name }} dest=/tmp/collect-info/commands
  59. with_items: "{{commands}}"
  60. - name: Fetch logs
  61. fetch: src={{ item }} dest=/tmp/collect-info/logs
  62. with_items: "{{logs}}"
  63. - name: Pack results and logs
  64. local_action: shell GZIP=-9 tar cvzf logs.tar.gz -C /tmp collect-info