From a9a016d7b16248ff5015d8689be8b07ec9f389f4 Mon Sep 17 00:00:00 2001
From: Matthew Mosesohn <mmosesohn@mirantis.com>
Date: Mon, 10 Apr 2017 18:49:17 +0300
Subject: [PATCH] Allow collect-logs.yaml to operate without inventory vars

---
 scripts/collect-info.yaml | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/scripts/collect-info.yaml b/scripts/collect-info.yaml
index b258284ee..e10cb7b2c 100644
--- a/scripts/collect-info.yaml
+++ b/scripts/collect-info.yaml
@@ -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}}"
+
-- 
GitLab