2016-08-08 11:38:25 +00:00
|
|
|
---
|
|
|
|
- hosts: all
|
2016-11-21 10:20:44 +00:00
|
|
|
become: true
|
2016-08-08 11:38:25 +00:00
|
|
|
gather_facts: no
|
|
|
|
|
|
|
|
vars:
|
|
|
|
commands:
|
|
|
|
- name: timedate_info
|
|
|
|
cmd: timedatectl status
|
|
|
|
- name: kernel_info
|
|
|
|
cmd: uname -r
|
|
|
|
- name: docker_info
|
2016-12-23 14:44:44 +00:00
|
|
|
cmd: "{{ docker_bin_dir }}/docker info"
|
2016-08-08 11:38:25 +00:00
|
|
|
- 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
|
2016-11-14 16:09:52 +00:00
|
|
|
cmd: journalctl -p err --no-pager
|
2016-11-03 12:57:33 +00:00
|
|
|
- name: etcd_info
|
2016-11-21 10:20:44 +00:00
|
|
|
cmd: etcdctl --peers={{ etcd_access_addresses }} cluster-health
|
2016-12-07 10:05:30 +00:00
|
|
|
- name: calico_info
|
|
|
|
cmd: "{{bin_dir}}/calicoctl node status"
|
|
|
|
- name: calico_workload_info
|
|
|
|
cmd: "{{bin_dir}}/calicoctl get workloadEndpoint -o wide"
|
|
|
|
- name: calico_pool_info
|
|
|
|
cmd: "{{bin_dir}}/calicoctl get ippool -o wide"
|
2016-11-09 13:15:27 +00:00
|
|
|
- name: weave_info
|
2016-11-21 10:20:44 +00:00
|
|
|
cmd: weave report
|
2016-11-09 13:15:27 +00:00
|
|
|
- name: weave_logs
|
2016-12-23 14:44:44 +00:00
|
|
|
cmd: "{{ docker_bin_dir }}/docker logs weave"
|
2016-11-21 10:20:44 +00:00
|
|
|
- name: kube_describe_all
|
|
|
|
cmd: kubectl describe all --all-namespaces
|
2016-12-23 14:44:44 +00:00
|
|
|
- name: kube_describe_nodes
|
|
|
|
cmd: kubectl describe nodes
|
2016-12-07 10:05:30 +00:00
|
|
|
- name: kubelet_logs
|
|
|
|
cmd: journalctl -u kubelet --no-pager
|
2016-11-09 13:15:27 +00:00
|
|
|
- name: kubedns_logs
|
2016-11-14 16:09:52 +00:00
|
|
|
cmd: "for i in `kubectl get pods --all-namespaces -l k8s-app=kubedns -o jsonpath={.items..metadata.name}`;
|
2016-12-13 10:43:06 +00:00
|
|
|
do kubectl logs ${i} --namespace {{system_namespace}} kubedns; done"
|
2016-11-09 13:15:27 +00:00
|
|
|
- name: apiserver_logs
|
2016-11-14 16:09:52 +00:00
|
|
|
cmd: "for i in `kubectl get pods --all-namespaces -l k8s-app=kube-apiserver -o jsonpath={.items..metadata.name}`;
|
2016-12-13 10:43:06 +00:00
|
|
|
do kubectl logs ${i} --namespace {{system_namespace}}; done"
|
2016-11-09 13:15:27 +00:00
|
|
|
- name: controller_logs
|
2016-11-14 16:09:52 +00:00
|
|
|
cmd: "for i in `kubectl get pods --all-namespaces -l k8s-app=kube-controller -o jsonpath={.items..metadata.name}`;
|
2016-12-13 10:43:06 +00:00
|
|
|
do kubectl logs ${i} --namespace {{system_namespace}}; done"
|
2016-11-09 13:15:27 +00:00
|
|
|
- name: scheduler_logs
|
2016-11-14 16:09:52 +00:00
|
|
|
cmd: "for i in `kubectl get pods --all-namespaces -l k8s-app=kube-scheduler -o jsonpath={.items..metadata.name}`;
|
2016-12-13 10:43:06 +00:00
|
|
|
do kubectl logs ${i} --namespace {{system_namespace}}; done"
|
2016-11-09 13:15:27 +00:00
|
|
|
- name: proxy_logs
|
2016-11-14 16:09:52 +00:00
|
|
|
cmd: "for i in `kubectl get pods --all-namespaces -l k8s-app=kube-proxy -o jsonpath={.items..metadata.name}`;
|
2016-12-13 10:43:06 +00:00
|
|
|
do kubectl logs ${i} --namespace {{system_namespace}}; done"
|
2016-11-09 13:15:27 +00:00
|
|
|
- name: nginx_logs
|
2016-11-14 16:09:52 +00:00
|
|
|
cmd: "for i in `kubectl get pods --all-namespaces -l k8s-app=kube-nginx -o jsonpath={.items..metadata.name}`;
|
2016-12-13 10:43:06 +00:00
|
|
|
do kubectl logs ${i} --namespace {{system_namespace}}; done"
|
2016-11-09 13:15:27 +00:00
|
|
|
- name: flannel_logs
|
2016-11-14 16:09:52 +00:00
|
|
|
cmd: "for i in `kubectl get pods --all-namespaces -l app=flannel -o jsonpath={.items..metadata.name}`;
|
2016-12-13 10:43:06 +00:00
|
|
|
do kubectl logs ${i} --namespace {{system_namespace}} flannel-container; done"
|
2016-11-09 13:15:27 +00:00
|
|
|
- name: canal_logs
|
2016-11-14 16:09:52 +00:00
|
|
|
cmd: "for i in `kubectl get pods --all-namespaces -l k8s-app=canal-node -o jsonpath={.items..metadata.name}`;
|
2016-12-13 10:43:06 +00:00
|
|
|
do kubectl logs ${i} --namespace {{system_namespace}} flannel; done"
|
2016-11-09 13:15:27 +00:00
|
|
|
- name: calico_policy_logs
|
2016-11-14 16:09:52 +00:00
|
|
|
cmd: "for i in `kubectl get pods --all-namespaces -l k8s-app=calico-policy -o jsonpath={.items..metadata.name}`;
|
2016-12-13 10:43:06 +00:00
|
|
|
do kubectl logs ${i} --namespace {{system_namespace}} calico-policy-controller; done"
|
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:
|
2016-11-21 10:20:44 +00:00
|
|
|
- set_fact:
|
|
|
|
etcd_access_addresses: |-
|
|
|
|
{% for item in groups['etcd'] -%}
|
|
|
|
https://{{ item }}:2379{% if not loop.last %},{% endif %}
|
|
|
|
{%- endfor %}
|
|
|
|
|
2016-08-08 11:38:25 +00:00
|
|
|
- name: Storing commands output
|
|
|
|
shell: "{{ item.cmd }} 2>&1 | tee {{ item.name }}"
|
|
|
|
register: output
|
2016-12-27 11:38:54 +00:00
|
|
|
failed_when: false
|
2016-08-08 11:38:25 +00:00
|
|
|
with_items: "{{commands}}"
|
2016-11-07 15:00:49 +00:00
|
|
|
no_log: True
|
2016-08-08 11:38:25 +00:00
|
|
|
|
|
|
|
- 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-11-16 10:30:00 +00:00
|
|
|
local_action: raw GZIP=-9 tar --remove-files -cvzf {{dir|default(".")}}/logs.tar.gz -C /tmp collect-info
|
2016-08-22 12:45:42 +00:00
|
|
|
run_once: true
|
|
|
|
|
|
|
|
- name: Clean up collected command outputs
|
|
|
|
file: path={{ item.name }} state=absent
|
|
|
|
with_items: "{{commands}}"
|