Fix tripleo_multipathd handling of blacklist section
Fix the tripleo_multipathd role's task that detects whether a blacklist section is present in /etc/multipath.conf. Previously, an error caused it to insert malformed lines in the file. NOTE(stable/train): Minor tweaks are required in order to avoid molecule 'check' failures that aren't seen in later releases. Resolves: rhbz#2159555 Change-Id: If85e8c3644af21455ce497d88ee975c056f4fcaa (cherry picked from commit21ee61309c
) (cherry picked from commitb2702e4611
) (cherry picked from commit6976f3f616
)
This commit is contained in:
parent
ac056b5df8
commit
0db9f931cc
|
@ -38,31 +38,38 @@
|
|||
mode: 0644
|
||||
when:
|
||||
- not result.stat.exists or result.stat.size == 0
|
||||
check_mode: false
|
||||
|
||||
- name: Set setype on /etc/multipath.conf
|
||||
file:
|
||||
path: /etc/multipath.conf
|
||||
setype: container_file_t
|
||||
|
||||
- name: Ensure a blacklist section is present
|
||||
lineinfile:
|
||||
path: /etc/multipath.conf
|
||||
regexp: '^blacklist'
|
||||
line: 'blacklist {'
|
||||
- name: Check if a blacklist section is present
|
||||
shell: grep -q '^blacklist\s*{' /etc/multipath.conf
|
||||
failed_when: false
|
||||
changed_when: false
|
||||
check_mode: false
|
||||
register: blacklist_section
|
||||
|
||||
- name: Terminate the blacklist section if one was added
|
||||
replace:
|
||||
path: /etc/multipath.conf
|
||||
regexp: '^(blacklist {)'
|
||||
replace: '\1\n}'
|
||||
- name: Add a blacklist section if it's missing
|
||||
block:
|
||||
- name: Start the blacklist section
|
||||
lineinfile:
|
||||
path: /etc/multipath.conf
|
||||
line: 'blacklist {'
|
||||
- name: Terminate the blacklist section
|
||||
replace:
|
||||
path: /etc/multipath.conf
|
||||
regexp: '^(blacklist {)'
|
||||
replace: '\1\n}'
|
||||
when:
|
||||
- blacklist_section.changed
|
||||
- blacklist_section.rc|int == 1
|
||||
|
||||
- name: Remove global blacklist if multipathd is enabled
|
||||
replace:
|
||||
path: /etc/multipath.conf
|
||||
regexp: '^blacklist {\n[\s]+devnode \"\.\*\"'
|
||||
regexp: '^blacklist\s*{\n[\s]+devnode \"\.\*\"'
|
||||
replace: 'blacklist {'
|
||||
when:
|
||||
- tripleo_multipathd_enable | bool
|
||||
|
@ -70,7 +77,7 @@
|
|||
- name: Add global blacklist if multipathd is disabled
|
||||
lineinfile:
|
||||
path: /etc/multipath.conf
|
||||
insertafter: '^blacklist'
|
||||
insertafter: '^blacklist\s*{'
|
||||
regexp: '^[\s]+devnode \"\.\*\"'
|
||||
line: ' devnode ".*"'
|
||||
when:
|
||||
|
|
Loading…
Reference in New Issue