fix diagnostic collector
add more diag commands
Change-Id: Icf2d1eb498800af7ae9f44e4c506d00fd7e4b4df
diff --git a/roles/head-diag/tasks/main.yml b/roles/head-diag/tasks/main.yml
index 065889e..e73417b 100644
--- a/roles/head-diag/tasks/main.yml
+++ b/roles/head-diag/tasks/main.yml
@@ -14,6 +14,7 @@
- name: Head node diag collection
shell: "{{ item }} > ~/{{ diag_dir }}/head/{{ item | regex_replace('[^\\w-]', '_')}}"
+ ignore_errors: yes
args:
creates: "~/{{ diag_dir }}/head/{{ item | regex_replace('[^\\w-]', '_')}}"
with_items:
@@ -26,18 +27,22 @@
- "cat /etc/lsb-release"
- "sudo uvt-kvm list"
- "sudo virsh list"
- - "sudo docker ps"
+ - "sudo lxc list"
+ - "sudo docker ps -a"
- name: Juju diag collection
shell: "{{ item }} > ~/{{ diag_dir }}/juju/{{ item | regex_replace('[^\\w-]', '_')}}"
+ ignore_errors: yes
args:
creates: "~/{{ diag_dir }}/juju/{{ item | regex_replace('[^\\w-]', '_')}}"
with_items:
- "juju status --format=summary"
+ - "juju status --format=tabular"
- "juju status --format=json"
- name: OpenStack diag collection
shell: "source ~/admin-openrc.sh && {{ item }} > ~/{{ diag_dir }}/openstack/{{ item | regex_replace('[^\\w-]', '_')}}"
+ ignore_errors: yes
args:
executable: "/bin/bash"
creates: "~/{{ diag_dir }}/openstack/{{ item | regex_replace('[^\\w-]', '_')}}"
@@ -45,6 +50,7 @@
- "glance image-list"
- "nova list --all-tenants"
- "nova host-list"
+ - "nova hypervisor-list"
- "keystone tenant-list"
- "keystone user-list"
- "neutron net-list"
@@ -52,7 +58,8 @@
- "neutron port-list"
- name: ONOS diag collection - REST API
- shell: "curl -X GET -u karaf:karaf http://onos-cord-1:8181/onos/v1/{{ item }} | python -m json.tool > ~/{{ diag_dir }}/onos/rest_{{ item | regex_replace('[^\\w-]', '_') }}"
+ shell: "curl -X GET -u karaf:karaf http://onos-cord:8182/onos/v1/{{ item }} | python -m json.tool > ~/{{ diag_dir }}/onos/rest_{{ item | regex_replace('[^\\w-]', '_') }}"
+ ignore_errors: yes
args:
creates: "~/{{ diag_dir }}/onos/rest_{{ item | regex_replace('[^\\w-]', '_')}}"
warn: False # get_url or uri can't easily redirect to a file
@@ -60,7 +67,8 @@
- "hosts"
- name: ONOS diag collection - ONOS CLI
- shell: "sshpass -p 'karaf' ssh -p 8101 karaf@onos-cord {{ item }} > ~/{{ diag_dir }}/onos/{{ item | regex_replace('[^\\w-]', '_') }}"
+ shell: "sshpass -p 'karaf' ssh -p 8102 karaf@onos-cord {{ item }} > ~/{{ diag_dir }}/onos/{{ item | regex_replace('[^\\w-]', '_') }}"
+ ignore_errors: yes
args:
creates: "~/{{ diag_dir }}/onos/{{ item | regex_replace('[^\\w-]', '_')}}"
with_items:
@@ -79,17 +87,18 @@
- "summary"
- name: Docker diag collection - Find names for all running Docker containers
- shell: "sudo docker ps --format '{{ '{{' }} .Names {{ '}}' }}'"
+ command: sudo docker ps --format '{{'{{'}} .Names {{'}}'}}'
+ ignore_errors: yes
register: docker_containers
tags:
- skip_ansible_lint # collecting docker container names
- name: Docker diag collection - Collect logs from Docker containers
shell: "sudo docker logs {{ item }} > ~/{{ diag_dir }}/docker/{{ item | regex_replace('[^\\w-]', '_')}} 2>&1"
+ ignore_errors: yes
args:
creates: "~/{{ diag_dir }}/docker/{{ item | regex_replace('[^\\w-]', '_')}}"
- with_items: "{{ docker_containers.stdout.split('\n') }}"
+ with_items: "{{ docker_containers.stdout_lines }}"
tags:
- skip_ansible_lint # ansible-lint interprets the \n incorrectly
-