Skip to content

Commit

Permalink
Copy external_openstack_cacert to control-planes from host
Browse files Browse the repository at this point in the history
  • Loading branch information
Nathanael-Mtd committed Aug 6, 2024
1 parent 1968db9 commit 020feb8
Showing 1 changed file with 22 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,30 @@
include_tasks: openstack-credential-check.yml
tags: external-openstack

- name: External OpenStack Cloud Controller | Test if external_openstack_cacert is a base64 string
set_fact:
external_openstack_cacert_is_base64: "{% if external_openstack_cacert is search('^([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{3}= | [A-Za-z0-9+/]{2}==)?$') %}true{% else %}false{% endif %}"
when:
- external_openstack_cacert is defined
- external_openstack_cacert | length > 0
tags: external-openstack

- name: External OpenStack Cloud Controller | Write cacert file
copy:
src: "{{ external_openstack_cacert if not external_openstack_cacert_is_base64 else omit }}"
content: "{{ external_openstack_cacert | b64decode if external_openstack_cacert_is_base64 else omit }}"
dest: "{{ kube_config_dir }}/external-openstack-cacert.pem"
group: "{{ kube_cert_group }}"
mode: 0640
when:
- inventory_hostname == groups['kube_control_plane'][0]
- external_openstack_cacert is defined
- external_openstack_cacert | length > 0
tags: external-openstack

- name: External OpenStack Cloud Controller | Get base64 cacert
slurp:
src: "{{ external_openstack_cacert }}"
src: "{{ kube_config_dir }}/external-openstack-cacert.pem"
register: external_openstack_cacert_b64
when:
- inventory_hostname == groups['kube_control_plane'][0]
Expand Down

0 comments on commit 020feb8

Please sign in to comment.