Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 15 additions & 18 deletions hooks/playbooks/install_custom_ca_certs.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,30 @@
---
- name: Set up custom CA secret for OpenStack control plane
- name: Prepare custom CA secret
hosts: "{{ cifmw_target_hook_host | default('localhost') }}"
gather_facts: false
connection: local
vars:
_custom_ca_cert_filepath: "{{ custom_ca_cert_filepath | mandatory }}"
_custom_ca_cert_url: "{{ custom_ca_cert_url | mandatory }}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(non-blocking) question: Don't we want to maintain functionallity to slurp local ca_cert?

_namespace: "{{ namespace | default('openstack') }}"
_controlplane_name: "{{ controlplane_name | default('controlplane') }}"
tasks:
- name: Download cert
ansible.builtin.get_url:
url: "{{ _custom_ca_cert_url }}"
dest: '/tmp/ca_cert.txt'
mode: '0644'
register: download_status
until: download_status is not failed and (download_status.status_code is undefined or download_status.status_code == 200)
retries: 10
delay: 5

- name: Read custom CA certificate file
ansible.builtin.slurp:
src: "{{ _custom_ca_cert_filepath }}"
src: "/tmp/ca_cert.txt"
register: custom_ca_certs

- name: Create custom CA secret
kubernetes.core.k8s:
kubeconfig: "{{ cifmw_openshift_kubeconfig }}"
state: present
definition:
apiVersion: v1
Expand All @@ -24,17 +35,3 @@
namespace: "{{ _namespace }}"
data:
CustomCACerts: "{{ custom_ca_certs.content }}"

- name: Patch OpenStack control plane to use custom CA secret
kubernetes.core.k8s:
state: patched
kind: OpenStackControlPlane
api_version: core.openstack.org/v1beta1
name: "{{ _controlplane_name }}"
namespace: "{{ _namespace }}"
definition:
spec:
tls:
podLevel:
enabled: true
caBundleSecretName: custom-ca-certs
Loading