|
| 1 | +--- |
| 2 | +# Set the applicationCredentialEnabled flag in skmo-values.yaml before the |
| 3 | +# leaf control plane kustomize build runs. |
| 4 | +# |
| 5 | +# The flag is read by the kustomization.yaml replacement and applied to |
| 6 | +# spec.applicationCredential.enabled on the OpenStackControlPlane CR. Setting |
| 7 | +# it here means the OSCP is created with AC enabled or disabled from the very |
| 8 | +# first apply — no reload or restart required. |
| 9 | +# |
| 10 | +# When enabled (the default), all leaf region services (barbican, cinder, |
| 11 | +# glance, neutron, nova, placement) authenticate to Keystone using Application |
| 12 | +# Credentials instead of plain passwords, enabling near zero downtime password |
| 13 | +# rotation. EDPM compute nodes receive AC credentials during their initial |
| 14 | +# deployment (stages 7+) so no separate EDPM redeployment is needed. |
| 15 | +# |
| 16 | +# Variables: |
| 17 | +# cifmw_skmo_appcred_enabled (default: true) |
| 18 | +# When false, applicationCredentialEnabled is written as false and the OSCP |
| 19 | +# is created without AC — identical to omitting the patch entirely. |
| 20 | +# cifmw_architecture_repo |
| 21 | +# Path to the local checkout of the architecture repository. |
| 22 | +- name: Set Application Credential enablement in skmo-values.yaml |
| 23 | + hosts: "{{ cifmw_target_hook_host | default('localhost') }}" |
| 24 | + gather_facts: false |
| 25 | + vars: |
| 26 | + cifmw_skmo_appcred_enabled: true |
| 27 | + _skmo_values_file: >- |
| 28 | + {{ cifmw_architecture_repo }}/examples/va/multi-namespace-skmo/control-plane2/skmo-values.yaml |
| 29 | + tasks: |
| 30 | + - name: Check skmo-values.yaml exists |
| 31 | + ansible.builtin.stat: |
| 32 | + path: "{{ _skmo_values_file }}" |
| 33 | + register: _skmo_values_stat |
| 34 | + |
| 35 | + - name: Assert skmo-values.yaml is present |
| 36 | + ansible.builtin.assert: |
| 37 | + that: _skmo_values_stat.stat.exists |
| 38 | + fail_msg: >- |
| 39 | + skmo-values.yaml not found at {{ _skmo_values_file }}. |
| 40 | + Ensure cifmw_architecture_repo points to a valid architecture checkout. |
| 41 | +
|
| 42 | + - name: Read skmo-values.yaml |
| 43 | + ansible.builtin.slurp: |
| 44 | + src: "{{ _skmo_values_file }}" |
| 45 | + register: _skmo_values_content |
| 46 | + |
| 47 | + - name: Parse and update applicationCredentialEnabled |
| 48 | + ansible.builtin.set_fact: |
| 49 | + _skmo_values_updated: >- |
| 50 | + {{ _skmo_values_content.content | b64decode | from_yaml | |
| 51 | + combine({'data': (_skmo_values_content.content | b64decode | from_yaml).data | |
| 52 | + combine({'applicationCredentialEnabled': cifmw_skmo_appcred_enabled | bool})}, |
| 53 | + recursive=True) }} |
| 54 | +
|
| 55 | + - name: Write updated skmo-values.yaml |
| 56 | + ansible.builtin.copy: |
| 57 | + content: "{{ _skmo_values_updated | to_nice_yaml(indent=2) }}" |
| 58 | + dest: "{{ _skmo_values_file }}" |
| 59 | + mode: '0644' |
0 commit comments