2016-08-08 11:38:25 +00:00
|
|
|
---
|
|
|
|
- hosts: all
|
|
|
|
become: true
|
|
|
|
gather_facts: no
|
|
|
|
|
|
|
|
vars:
|
|
|
|
debug: false
|
|
|
|
commands:
|
|
|
|
- name: timedate_info
|
|
|
|
cmd: timedatectl status
|
|
|
|
- name: kernel_info
|
|
|
|
cmd: uname -r
|
|
|
|
- name: docker_info
|
|
|
|
cmd: docker info
|
|
|
|
- name: ip_info
|
|
|
|
cmd: ip -4 -o a
|
|
|
|
- name: route_info
|
|
|
|
cmd: ip ro
|
|
|
|
- name: proc_info
|
|
|
|
cmd: ps auxf | grep -v ]$
|
2016-08-22 12:45:42 +00:00
|
|
|
- name: systemctl_failed_info
|
|
|
|
cmd: systemctl --state=failed --no-pager
|
2016-08-08 11:38:25 +00:00
|
|
|
- name: k8s_info
|
|
|
|
cmd: kubectl get all --all-namespaces -o wide
|
|
|
|
- name: errors_info
|
|
|
|
cmd: journalctl -p err --utc --no-pager
|
2016-11-03 12:57:33 +00:00
|
|
|
- name: etcd_info
|
|
|
|
cmd: etcdctl --debug cluster-health
|
2016-08-08 11:38:25 +00:00
|
|
|
|
|
|
|
logs:
|
|
|
|
- /var/log/syslog
|
|
|
|
- /var/log/daemon.log
|
|
|
|
- /var/log/kern.log
|
2016-11-03 12:57:33 +00:00
|
|
|
- /var/log/dpkg.log
|
|
|
|
- /var/log/apt/history.log
|
|
|
|
- /var/log/yum.log
|
|
|
|
- /var/log/calico/bird/current
|
|
|
|
- /var/log/calico/bird6/current
|
|
|
|
- /var/log/calico/felix/current
|
|
|
|
- /var/log/calico/confd/current
|
2016-08-08 11:38:25 +00:00
|
|
|
|
|
|
|
tasks:
|
|
|
|
- name: Storing commands output
|
|
|
|
shell: "{{ item.cmd }} 2>&1 | tee {{ item.name }}"
|
|
|
|
register: output
|
|
|
|
ignore_errors: true
|
|
|
|
with_items: "{{commands}}"
|
|
|
|
|
|
|
|
- debug: var=item
|
2016-11-03 12:57:33 +00:00
|
|
|
with_items: "{{output.results}}"
|
2016-08-08 11:38:25 +00:00
|
|
|
when: debug
|
|
|
|
|
|
|
|
- name: Fetch results
|
|
|
|
fetch: src={{ item.name }} dest=/tmp/collect-info/commands
|
|
|
|
with_items: "{{commands}}"
|
|
|
|
|
|
|
|
- name: Fetch logs
|
|
|
|
fetch: src={{ item }} dest=/tmp/collect-info/logs
|
|
|
|
with_items: "{{logs}}"
|
|
|
|
|
|
|
|
- name: Pack results and logs
|
2016-08-22 12:45:42 +00:00
|
|
|
local_action: shell GZIP=-9 tar --remove-files -cvzf logs.tar.gz -C /tmp collect-info
|
|
|
|
run_once: true
|
|
|
|
|
|
|
|
- name: Clean up collected command outputs
|
|
|
|
file: path={{ item.name }} state=absent
|
|
|
|
with_items: "{{commands}}"
|