-
Notifications
You must be signed in to change notification settings - Fork 6
/
set-debug.yml
109 lines (96 loc) · 3.32 KB
/
set-debug.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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# Get and display value of debug if no parameters are set
# Pass debug=true or debug=false to change all config files to that value
- hosts: controller
remote_user: "{{ remote_user }}"
become: "{{ become }}"
vars:
config_files:
- /etc/glance/glance-api.conf
- /etc/glance/glance-registry.conf
- /etc/cinder/cinder.conf
- /etc/keystone/keystone.conf
tasks:
- name: Get old Debug Settings
shell: openstack-config --get {{ item }} DEFAULT debug
register: openstack_config_debug_old
changed_when: no
ignore_errors: yes
with_items: "{{ config_files }}"
- name: Display old value
debug:
msg: "Old value of DEBUG for {{ item.item }} is {{ item.stdout }}"
verbosity: 1
with_items: "{{ openstack_config_debug_old.results }}"
when: item.rc == 0
- name: Set Debug Settings
shell: openstack-config --set {{ item }} DEFAULT debug {{ debug }}
changed_when: no
ignore_errors: yes
with_items: "{{ config_files }}"
when: debug is defined
- name: Get new Debug Settings
shell: openstack-config --get {{ item }} DEFAULT debug
register: openstack_config_debug_new
changed_when: no
ignore_errors: yes
with_items: "{{ config_files }}"
when: debug is defined
- name: Display new value
debug:
msg: "New value of DEBUG for {{ item.item }} is {{ item.stdout }}"
verbosity: 1
with_items: "{{ openstack_config_debug_new.results }}"
when:
- "{{ item.rc | default(1) == 0 }}"
- debug is defined
- hosts: all:!localhost
remote_user: "{{ remote_user }}"
become: "{{ become }}"
vars:
config_files:
- /etc/nova/nova.conf
- /etc/neutron/neutron.conf
- /etc/neutron/metadata_agent.ini
- /etc/neutron/l3_agent.ini
- /etc/neutron/dhcp_agent.ini
tasks:
- name: Get old Debug Settings
shell: openstack-config --get {{ item }} DEFAULT debug
register: openstack_config_debug_old
changed_when: no
ignore_errors: yes
with_items: "{{ config_files }}"
- name: Display old value
debug:
msg: "Old value of DEBUG for {{ item.item }} is {{ item.stdout }}"
verbosity: 1
with_items: "{{ openstack_config_debug_old.results }}"
when: item.rc == 0
- name: Set Debug Settings
shell: openstack-config --set {{ item }} DEFAULT debug {{ debug }}
changed_when: no
ignore_errors: yes
with_items: "{{ config_files }}"
when: debug is defined
- name: Get new Debug Settings
shell: openstack-config --get {{ item }} DEFAULT debug
register: openstack_config_debug_new
changed_when: no
ignore_errors: yes
with_items: "{{ config_files }}"
when: debug is defined
- name: Display new value
debug:
msg: "New value of DEBUG for {{ item.item }} is {{ item.stdout }}"
verbosity: 1
with_items: "{{ openstack_config_debug_new.results }}"
when:
- "{{ item.rc | default(1) == 0 }}"
- debug is defined
- name: Restart OpenStack services
command: openstack-service restart
when: debug is defined
- name: Debug not defined
debug:
msg: "Variable for 'debug' not set, so values were only extracted and nothing was changed"
when: debug is not defined