blob: ae0053b0f228635900fc9f0144298bae4049e247 [file] [log] [blame]
Zack Williams6f0d88e2018-01-13 23:04:02 -07001---
Matteo Scandolo3896c472017-08-01 13:31:42 -07002# Copyright 2017-present Open Networking Foundation
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
Zack Williamsa2763112017-01-03 11:38:38 -070016# collect-diag-playbook.yml
Zack Williams6f0d88e2018-01-13 23:04:02 -070017# Collects diagnostic information for the currently running POD
Zack Williams2bfbbd62016-06-13 10:18:19 -070018
Zack Williamsba7af9e2016-06-27 17:21:09 -070019- name: Create diag_dir fact
Zack Williams04106732016-06-27 20:55:32 -070020 hosts: head
21 tasks:
Zack Williams35624562016-08-28 17:12:26 -070022 - name: Set diag_dir name to diag-rfc3339_datetime
23 set_fact:
Zack Williams04106732016-06-27 20:55:32 -070024 diag_dir: "diag-{{ ansible_date_time.iso8601_basic_short }}"
Zack Williamsba7af9e2016-06-27 17:21:09 -070025
Zack Williams2bfbbd62016-06-13 10:18:19 -070026- name: Diagnostics on head node
27 hosts: head
28 roles:
29 - head-diag
Zack Williamsba7af9e2016-06-27 17:21:09 -070030
31- name: Diagnostics on compute nodes
32 hosts: compute
33 roles:
34 - compute-diag
35
36- name: Collect compute node diagnostics on head node
Zack Williams6f0d88e2018-01-13 23:04:02 -070037 hosts: head
Zack Williams04106732016-06-27 20:55:32 -070038 tasks:
Zack Williams6f0d88e2018-01-13 23:04:02 -070039 - name: rsync diag_dir from compute nodes to head node
40 when: groups['compute'] | length > 0
41 command: >
42 rsync -a
43 "ubuntu@{{ item }}:/tmp/{{ hostvars[groups['head'][0]]['diag_dir'] }}/{{ item }}"
44 "~/{{ hostvars[groups['head'][0]]['diag_dir'] }}/"
45 with_items: "{{ groups['compute'] }}"
46 tags:
47 - skip_ansible_lint # the synchronize module can't set the remote username with delegate_to
Zack Williamsba7af9e2016-06-27 17:21:09 -070048