Skip to content

Commit 4a57ba0

Browse files
committed
Merge PR #351 by @Nemtal to 2.5 as well
1 parent ce9a77a commit 4a57ba0

File tree

1 file changed

+20
-9
lines changed

1 file changed

+20
-9
lines changed

Diff for: tasks/bbb_secret.yml

+20-9
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,27 @@
11
---
2-
- name: Set bbb_secret as fact
2+
- name: Set bbb_secret as fact if bbb-conf is present
33
when: bbb_secret is not defined
44
block:
5-
- name: Register bbb secret
5+
- name: Check if bbb-conf is present
66
become: true
7-
command: bbb-conf --secret
7+
command: which bbb-conf
88
changed_when: false
9+
failed_when: which_bbb_conf.rc not in [0, 1]
910
check_mode: false
10-
register: result
11+
register: which_bbb_conf
1112

12-
- name: Parse bbb secret
13-
set_fact:
14-
bbb_secret: "{{ result.stdout | regex_search('Secret: ([a-zA-Z0-9]*)', multiline=True) | regex_replace('Secret: ') }}"
15-
cacheable: true
16-
when: result.rc == 0
13+
- name: Set bbb_secret as fact
14+
when: which_bbb_conf.rc == 0
15+
block:
16+
- name: Register bbb secret
17+
become: true
18+
command: bbb-conf --secret
19+
changed_when: false
20+
check_mode: false
21+
register: result
22+
23+
- name: Parse bbb secret
24+
set_fact:
25+
bbb_secret: "{{ result.stdout | regex_search('Secret: ([a-zA-Z0-9]*)', multiline=True) | regex_replace('Secret: ') }}"
26+
cacheable: true
27+
when: result.rc == 0

0 commit comments

Comments
 (0)