more complete diagnostic playbook
diff --git a/cord-diag-playbook.yml b/cord-diag-playbook.yml
index 3e7a157..ea06cda 100644
--- a/cord-diag-playbook.yml
+++ b/cord-diag-playbook.yml
@@ -2,7 +2,10 @@
# Collects diagnostic information for the currently running cord-pod config
- name: Create diag_dir fact
- set_fact: diag_dir="~/diag-{{ ansible_date_time.iso8601_basic_short }}"
+ hosts: head
+ tasks:
+ - set_fact:
+ diag_dir: "diag-{{ ansible_date_time.iso8601_basic_short }}"
- name: Diagnostics on head node
hosts: head
@@ -16,9 +19,11 @@
- name: Collect compute node diagnostics on head node
hosts: compute
- synchronize:
- src: "{{ diag_dir }}"
- dest: "{{ diag_dir }}"
- recursive: yes
- delegate_to: "{{ groups['head'][0] }}"
+ tasks:
+ - synchronize:
+ src: "/tmp/{{ hostvars[groups['head'][0]]['diag_dir'] }}/{{ inventory_hostname }}"
+ dest: "~/{{ hostvars[groups['head'][0]]['diag_dir'] }}/"
+ recursive: yes
+ mode: pull
+ delegate_to: "{{ groups['head'][0] }}"
diff --git a/inventory/single-localhost b/inventory/single-localhost
index 5b70063..7f86038 100644
--- a/inventory/single-localhost
+++ b/inventory/single-localhost
@@ -1,5 +1,5 @@
[all:vars]
-ansible_ssh_user=ubuntu
+ansible_ssh_user=replaceme
[head]
localhost
@@ -8,5 +8,5 @@
localhost
[compute]
-nova-compute-1
+nova-compute-1 ansible_ssh_user=ubuntu
diff --git a/roles/compute-diag/tasks/main.yml b/roles/compute-diag/tasks/main.yml
index 050c7c5..d6290b9 100644
--- a/roles/compute-diag/tasks/main.yml
+++ b/roles/compute-diag/tasks/main.yml
@@ -1,12 +1,13 @@
---
# compute-diag/tasks/main.yml
-
-- name: Create diag_dir subdirs
+#
+- name: Create diag_dir subdir
file:
- dest="{{ diag_dir }}/{{ inventory_hostname }}"
+ dest="/tmp/{{ hostvars[groups['head'][0]]['diag_dir'] }}/{{ inventory_hostname }}"
+ state=directory
- name: Compute node diag collection
- shell: "{{ item }} > {{ diag_dir }}/{{ inventory_hostname}}/{{ item | regex_replace('[^\\w-]', '_')}}"
+ shell: "{{ item }} > /tmp/{{ hostvars[groups['head'][0]]['diag_dir'] }}/{{ inventory_hostname }}/{{ item | regex_replace('[^\\w-]', '_')}}"
with_items:
- "arp -n"
- "brctl show"
diff --git a/roles/head-diag/tasks/main.yml b/roles/head-diag/tasks/main.yml
index 71723a2..f21ab89 100644
--- a/roles/head-diag/tasks/main.yml
+++ b/roles/head-diag/tasks/main.yml
@@ -3,7 +3,7 @@
- name: Create diag_dir subdirs
file:
- dest="{{ diag_dir }}/{{ item }}"
+ dest="~/{{ diag_dir }}/{{ item }}"
state=directory
with_items:
- net
@@ -13,7 +13,7 @@
- xos
- name: Networking diag collection
- shell: "{{ item }} > {{ diag_dir }}/net/{{ item | regex_replace('[^\\w-]', '_')}}"
+ shell: "{{ item }} > ~/{{ diag_dir }}/net/{{ item | regex_replace('[^\\w-]', '_')}}"
with_items:
- "ifconfig -a"
- "route -n"
@@ -23,13 +23,13 @@
- "sudo uvt-kvm list"
- name: Juju diag collection
- shell: "{{ item }} > {{ diag_dir }}/juju/{{ item | regex_replace('[^\\w-]', '_')}}"
+ shell: "{{ item }} > ~/{{ diag_dir }}/juju/{{ item | regex_replace('[^\\w-]', '_')}}"
with_items:
- "juju status --format=summary"
- "juju status --format=json"
- name: OpenStack diag collection
- shell: "source ~/admin-openrc.sh && {{ item }} > {{ diag_dir }}/openstack/{{ item | regex_replace('[^\\w-]', '_')}}"
+ shell: "source ~/admin-openrc.sh && {{ item }} > ~/{{ diag_dir }}/openstack/{{ item | regex_replace('[^\\w-]', '_')}}"
args:
executable: "/bin/bash"
with_items:
@@ -43,12 +43,12 @@
- "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-1:8181/onos/v1/{{ item }} | python -m json.tool > ~/{{ diag_dir }}/onos/rest_{{ item | regex_replace('[^\\w-]', '_') }}"
with_items:
- "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 8101 karaf@onos-cord {{ item }} > ~/{{ diag_dir }}/onos/{{ item | regex_replace('[^\\w-]', '_') }}"
with_items:
- "cordvtn-nodes"
- "cordvtn-node-check nova-compute-1"
@@ -56,7 +56,7 @@
- "dhcp-list"
- name: XOS diag collection
- shell: "ssh ubuntu@xos-1 \"{{ item }}\" > {{ diag_dir }}/xos/{{ item | regex_replace('[^\\w-]', '_')}}"
+ shell: "ssh ubuntu@xos-1 \"{{ item }}\" > ~/{{ diag_dir }}/xos/{{ item | regex_replace('[^\\w-]', '_')}}"
with_items:
- "docker ps"
- "arp -n"
@@ -67,5 +67,5 @@
with_items:
- "scp {{ role_path }}/files/docker_logs.sh ubuntu@xos-1:~/docker_logs.sh"
- "ssh ubuntu@xos-1 'bash ~/docker_logs.sh'"
- - "rsync -avP ubuntu@xos-1:~/docker_logs/ {{ diag_dir }}/xos/"
+ - "rsync -avP ubuntu@xos-1:~/docker_logs/ ~/{{ diag_dir }}/xos/"
diff --git a/scripts/single-node-pod.sh b/scripts/single-node-pod.sh
index a85a002..b20c94c 100755
--- a/scripts/single-node-pod.sh
+++ b/scripts/single-node-pod.sh
@@ -39,7 +39,7 @@
cd ~/openstack-cluster-setup
git checkout $SETUP_BRANCH
- sed -i "s/ubuntu/`whoami`/" $INVENTORY
+ sed -i "s/replaceme/`whoami`/" $INVENTORY
cp vars/example_keystone.yml vars/cord_keystone.yml
# Log into the local node once to get host key
@@ -202,6 +202,11 @@
ssh ubuntu@nova-compute "sudo lxc-attach -n testclient -- curl -s http://$PUBLICIP"
}
+function run_diagnostics() {
+ echo "*** COLLECTING DIAGNOSTIC INFO - check ~/diag-* on the head node"
+ ansible-playbook -i $INVENTORY cord-diag-playbook.yml
+}
+
# Parse options
RUN_TEST=0
EXAMPLESERVICE=0
@@ -209,16 +214,20 @@
INVENTORY="inventory/single-localhost"
XOS_BRANCH="master"
XOS_REPO_URL="https://gerrit.opencord.org/xos"
+DIAGNOSTICS=1
-while getopts "b:ehi:r:ts:" opt; do
+while getopts "b:dehi:r:ts:" opt; do
case ${opt} in
b ) XOS_BRANCH=$OPTARG
;;
+ d ) DIAGNOSTICS=0
+ ;;
e ) EXAMPLESERVICE=1
;;
h ) echo "Usage:"
echo " $0 install OpenStack and prep XOS and ONOS VMs [default]"
echo " $0 -b <branch> build XOS containers using the <branch> branch of XOS git repo"
+ echo " $0 -d don't run diagnostic collector"
echo " $0 -e add exampleservice to XOS"
echo " $0 -h display this help message"
echo " $0 -i <inv_file> specify an inventory file (default is inventory/single-localhost)"
@@ -264,5 +273,9 @@
fi
fi
+if [[ $DIAGNOSTICS -eq 1 ]]
+ run_diagnostics
+fi
+
exit 0