Allow collect-logs.yaml to operate without inventory vars
parent
ab12b23e6f
commit
a9a016d7b1
|
@ -4,6 +4,10 @@
|
|||
gather_facts: no
|
||||
|
||||
vars:
|
||||
docker_bin_dir: /usr/bin
|
||||
bin_dir: /usr/local/bin
|
||||
system_namespace: kube-system
|
||||
ansible_ssh_pipelining: true
|
||||
commands:
|
||||
- name: timedate_info
|
||||
cmd: timedatectl status
|
||||
|
@ -24,7 +28,7 @@
|
|||
- name: errors_info
|
||||
cmd: journalctl -p err --no-pager
|
||||
- name: etcd_info
|
||||
cmd: etcdctl --peers={{ etcd_access_addresses }} cluster-health
|
||||
cmd: etcdctl --peers={{ etcd_access_addresses | default("http://127.0.0.1:2379") }} cluster-health
|
||||
- name: calico_info
|
||||
cmd: "{{bin_dir}}/calicoctl node status"
|
||||
- name: calico_workload_info
|
||||
|
@ -87,10 +91,10 @@
|
|||
{% for item in groups['etcd'] -%}
|
||||
https://{{ item }}:2379{% if not loop.last %},{% endif %}
|
||||
{%- endfor %}
|
||||
when: "'etcd' in groups"
|
||||
|
||||
- name: Storing commands output
|
||||
shell: "{{ item.cmd }} 2>&1 | tee {{ item.name }}"
|
||||
register: output
|
||||
failed_when: false
|
||||
with_items: "{{commands}}"
|
||||
no_log: True
|
||||
|
@ -98,6 +102,7 @@
|
|||
- name: Fetch results
|
||||
fetch: src={{ item.name }} dest=/tmp/collect-info/commands
|
||||
with_items: "{{commands}}"
|
||||
failed_when: false
|
||||
|
||||
- name: Fetch logs
|
||||
fetch: src={{ item }} dest=/tmp/collect-info/logs
|
||||
|
@ -110,3 +115,4 @@
|
|||
- name: Clean up collected command outputs
|
||||
file: path={{ item.name }} state=absent
|
||||
with_items: "{{commands}}"
|
||||
|
||||
|
|
Loading…
Reference in New Issue