Skip to content

Commit 736ee2b

Browse files
authored
Merge pull request #19 from shiftstack/fix-ocp-creds-yaml-parsing
Fix rotate_app_creds YAML parsing when from_yaml returns a list
2 parents da3299d + d38cd8f commit 736ee2b

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

collection/stages/roles/day2ops/tasks/procedures/rotate_app_creds.yml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,24 @@
1010
name: shiftstack.stages.prepare
1111
tasks_from: app_creds.yml
1212

13-
- name: Rotate OpenShift Cloud Credentials
13+
- name: Create clouds.yaml copy with cloud renamed for OCP secret
1414
ansible.builtin.shell: |
1515
set -o pipefail && \
16-
cat {{ clouds_yaml_file_path }} | sed 's/{{ user_cloud }}:/openstack:/' | \
17-
oc set data -n kube-system secret/openstack-credentials clouds.yaml=-
16+
cat {{ clouds_yaml_file_path }} | sed '/^---$/d' | sed 's/{{ user_cloud }}:/openstack:/' > /tmp/clouds_for_ocp.yaml
17+
changed_when: false
18+
19+
- name: Rotate OpenShift Cloud Credentials
20+
ansible.builtin.shell: |
21+
oc set data -n kube-system secret/openstack-credentials clouds.yaml="$(cat /tmp/clouds_for_ocp.yaml)"
1822
environment:
1923
KUBECONFIG: "{{ kubeconfig }}"
2024
changed_when: true
2125

26+
- name: Clean up temporary file
27+
ansible.builtin.file:
28+
path: /tmp/clouds_for_ocp.yaml
29+
state: absent
30+
2231
- name: Get OpenStack Credentials from OCP cluster
2332
ansible.builtin.shell: |
2433
set -o pipefail && \

0 commit comments

Comments
 (0)