-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.yml
82 lines (75 loc) · 3.17 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
---
- name: Gather hypervisor Logs
hosts: hypervisor
gather_facts: yes
become: no
tags: collect_hypervisor_logs
any_errors_fatal: false # as we are happy to collect whatever we can
vars:
- dest_dir: "{{ (other.dest|default({})).dir|default('') | absolute_path }}"
vars_files:
- vars/default_archives_list.yml
tasks:
# this one is required to avoid 3 or 4 return codes
# when some of hosts are unreachable
- name: clear error after setup
meta: clear_host_errors
- block:
- import_tasks: tasks/collect_hypervisor_logs.yml
- import_tasks: tasks/compress_fetch_cleanup.yml
when:
- inventory_hostname in play_hosts
- other.logger in ['host','all']
- name: Gather Logs
hosts: "{{ other.hosts }}"
gather_facts: yes
become: yes
any_errors_fatal: false # as we are happy to collect whatever we can
vars:
- dest_dir: "{{ (other.dest|default({})).dir|default('') | absolute_path }}"
vars_files:
- vars/default_archives_list.yml
tasks:
# this one is required to avoid 3 or 4 return codes
# when some of hosts are unreachable
- name: clear error after setup
meta: clear_host_errors
- name: run collect logs
import_tasks: tasks/collect_host_logs.yml
when:
- inventory_hostname in play_hosts
- other.logger in ['host','all']
- name: run sosreport
import_tasks: tasks/collect_sosreport.yml
when:
- inventory_hostname in play_hosts
- other.logger in ['sosreport','all']
- name: Aggregate and print info for build marks
hosts: localhost
gather_facts: no
become: no
tasks:
- name: "initialize temp variables"
set_fact:
selinux_problems: 0
# use list to convert selinux avc denials from all nodes into list of unique patterns from all of them together
segfault_problems: 0
oom_killer_problems: 0
# aggregate from all hosts, excluding any nonproduct ones
# non product is localhost and tester nodes (unless they are also UC or controller too)
counted_hosts: "{{ groups['all'] | difference( groups['local'] + (groups['tester'] | default([]) | difference(groups['undercloud']|default([]) + groups['controller']|default([]))) ) }}"
- debug:
msg: "counting issues from hosts: {{ counted_hosts }}"
- name: "add together all issue counts from all hosts except localhost and tester"
set_fact:
selinux_problems: "{{ selinux_problems | int + (hostvars[item]['selinux_problems_found'] | default([]) | length ) }}"
segfault_problems: "{{ segfault_problems | int + ( hostvars[item]['segfault_problems_found'] | default([]) | length ) }}"
oom_killer_problems: "{{ oom_killer_problems | int + ( hostvars[item]['oom_killer_problems_found'] | default([]) | length ) }}"
with_items: "{{ counted_hosts }}"
- name: "print out build marks"
debug:
msg: "Build mark: {{ item }}_found={{ hostvars[inventory_hostname][item] }}"
with_items:
- selinux_problems
- segfault_problems
- oom_killer_problems