Append item to custom_env_files of undercloud.conf
Append item to custom_env_files if it's already present in undercloud.conf Insert custom_env_files when undercloud.conf doesn't have it Closes-Bug: 1981081 Change-Id: I0d62ad4e10e1dbb2a6019815fc133237f6ee40fe
This commit is contained in:
parent
43b712d476
commit
fa5da6083b
|
@ -1,16 +1,39 @@
|
||||||
---
|
---
|
||||||
- name: Create the entry in undercloud.conf
|
- name: Check undercloud.conf exists
|
||||||
ini_file:
|
stat:
|
||||||
path: "{{ working_dir }}/undercloud.conf"
|
path: "{{ working_dir }}/undercloud.conf"
|
||||||
section: DEFAULT
|
register: under_conf_exist
|
||||||
option: custom_env_files
|
- block:
|
||||||
value: "{{ working_dir }}/skip_rhel_release.yaml"
|
- name: "Retrieve remote ini file"
|
||||||
|
fetch:
|
||||||
- name: Create the heat parameter file for undercloud.
|
src: "{{ working_dir }}/undercloud.conf"
|
||||||
vars:
|
dest: '/tmp/'
|
||||||
skip_rhel:
|
flat: true
|
||||||
parameter_defaults:
|
- name: Read current custom_env_files files
|
||||||
SkipRhelEnforcement: true
|
set_fact:
|
||||||
copy:
|
current_custom_env: "{{ lookup( 'ini', 'custom_env_files section=DEFAULT file=/tmp/undercloud.conf') }}"
|
||||||
content: "{{ skip_rhel | to_nice_yaml }}"
|
- name: Append skip_rhel_release.yaml to custom_env_files
|
||||||
dest: "{{ working_dir }}/skip_rhel_release.yaml"
|
ini_file:
|
||||||
|
path: "{{ working_dir }}/undercloud.conf"
|
||||||
|
section: DEFAULT
|
||||||
|
option: custom_env_files
|
||||||
|
value: "{{ current_custom_env.split(',')| union([working_dir+'/skip_rhel_release.yaml'])|map('trim')|unique|join(',')}}"
|
||||||
|
backup: true
|
||||||
|
when: current_custom_env | default([]) | length > 0
|
||||||
|
- name: Insert custom_env_files
|
||||||
|
ini_file:
|
||||||
|
path: "{{ working_dir }}/undercloud.conf"
|
||||||
|
section: DEFAULT
|
||||||
|
option: custom_env_files
|
||||||
|
value: "{{ working_dir }}/skip_rhel_release.yaml"
|
||||||
|
backup: true
|
||||||
|
when: current_custom_env | default([]) | length == 0
|
||||||
|
- name: Create the heat parameter file for undercloud.
|
||||||
|
vars:
|
||||||
|
skip_rhel:
|
||||||
|
parameter_defaults:
|
||||||
|
SkipRhelEnforcement: true
|
||||||
|
copy:
|
||||||
|
content: "{{ skip_rhel | to_nice_yaml }}"
|
||||||
|
dest: "{{ working_dir }}/skip_rhel_release.yaml"
|
||||||
|
when: under_conf_exist.stat.exists
|
||||||
|
|
Loading…
Reference in New Issue