Zack Williams | 6f0d88e | 2018-01-13 23:04:02 -0700 | [diff] [blame] | 1 | --- |
Matteo Scandolo | 3896c47 | 2017-08-01 13:31:42 -0700 | [diff] [blame] | 2 | # 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 Williams | a276311 | 2017-01-03 11:38:38 -0700 | [diff] [blame] | 16 | # collect-diag-playbook.yml |
Zack Williams | 6f0d88e | 2018-01-13 23:04:02 -0700 | [diff] [blame] | 17 | # Collects diagnostic information for the currently running POD |
Zack Williams | 2bfbbd6 | 2016-06-13 10:18:19 -0700 | [diff] [blame] | 18 | |
Zack Williams | ba7af9e | 2016-06-27 17:21:09 -0700 | [diff] [blame] | 19 | - name: Create diag_dir fact |
Zack Williams | 0410673 | 2016-06-27 20:55:32 -0700 | [diff] [blame] | 20 | hosts: head |
| 21 | tasks: |
Zack Williams | 3562456 | 2016-08-28 17:12:26 -0700 | [diff] [blame] | 22 | - name: Set diag_dir name to diag-rfc3339_datetime |
| 23 | set_fact: |
Zack Williams | 0410673 | 2016-06-27 20:55:32 -0700 | [diff] [blame] | 24 | diag_dir: "diag-{{ ansible_date_time.iso8601_basic_short }}" |
Zack Williams | ba7af9e | 2016-06-27 17:21:09 -0700 | [diff] [blame] | 25 | |
Zack Williams | 2bfbbd6 | 2016-06-13 10:18:19 -0700 | [diff] [blame] | 26 | - name: Diagnostics on head node |
| 27 | hosts: head |
| 28 | roles: |
| 29 | - head-diag |
Zack Williams | ba7af9e | 2016-06-27 17:21:09 -0700 | [diff] [blame] | 30 | |
| 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 Williams | 6f0d88e | 2018-01-13 23:04:02 -0700 | [diff] [blame] | 37 | hosts: head |
Zack Williams | 0410673 | 2016-06-27 20:55:32 -0700 | [diff] [blame] | 38 | tasks: |
Zack Williams | 6f0d88e | 2018-01-13 23:04:02 -0700 | [diff] [blame] | 39 | - 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 Williams | ba7af9e | 2016-06-27 17:21:09 -0700 | [diff] [blame] | 48 | |