Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add playbook to configure lunasa access for barbican #2630

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions docs/dictionary/en-custom.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ az
azs
backend
backends
barbican
baremetal
baremetalhost
basedir
Expand All @@ -46,6 +47,7 @@ bootmacaddress
bootmode
buildah
buildpkgs
cacert
cacheable
catalogsource
cci
Expand Down Expand Up @@ -209,6 +211,8 @@ hostnames
hostvars
hotfix
href
hsm
hsms
https
ic
icjbuue
Expand Down Expand Up @@ -307,6 +311,7 @@ mellanox
metallb
metalsmith
mgmt
minclient
mins
minsizegigabytes
mlnx
Expand Down
89 changes: 89 additions & 0 deletions hooks/playbooks/barbican-enable-luna.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
---
- name: Create modified barbican image and get secrets
hosts: "{{ cifmw_target_hook_host | default('localhost') }}"
tasks:
- name: Check out the role git repo
ansible.builtin.git:
dest: "./rhoso_luna_hsm"
repo: "{{ cifmw_hsm_luna_ansible_role_repo | default('https://github.com/openstack-k8s-operators/ansible-role-rhoso-luna-hsm.git', true) }}"
version: "{{ cifmw_hsm_luna_ansible_role_version| default('main', true) }}"

- name: Create and upload the new barbican images
ansible.builtin.include_role:
name: rhoso_luna_hsm
tasks_from: create_image
vars:
barbican_src_image_registry: "{{ content_provider_registry_ip }}:5001"
barbican_src_image_namespace: "{{ cifmw_set_openstack_containers_namespace }}"
barbican_src_image_tag: "{{ cifmw_update_extras['cifmw_set_openstack_containers_tag'] }}"
barbican_dest_image_registry: "{{ content_provider_registry_ip }}:5001"
barbican_dest_image_namespace: "{{ cifmw_set_openstack_containers_namespace }}"
barbican_dest_image_tag: "{{ cifmw_update_extras['cifmw_set_openstack_containers_tag'] }}{{ cifmw_update_barbican_custom_tag }}"
image_registry_verify_tls: "{{ cifmw_image_registry_verify_tls | default('false', true) }}"
luna_minclient_src: "{{ cifmw_hsm_luna_minclient_src }}"

- name: Create secrets with the HSM certs and hsm-login credentials
ansible.builtin.include_role:
name: rhoso_luna_hsm
tasks_from: create_secrets
vars:
luna_client_name: "{{ cifmw_hsm_client_name }}"
chrystoki_conf_src: "{{ cifmw_hsm_chrystoki_conf_src }}"
luna_server_cert_src: "{{ cifmw_hsm_luna_server_cert_src }}"
luna_client_cert_src: "{{ cifmw_hsm_luna_client_cert_src }}"
luna_partition_password: "{{ cifmw_hsm_partition_password }}"
kubeconfig_path: "{{ cifmw_openshift_kubeconfig }}"
oc_dir: "{{ cifmw_path }}"
luna_data_secret: "{{ cifmw_hsm_luna_client_data_secret | default('barbican-luna-client-data', true) }}"
login_secret: "{{ cifmw_hsm_login_secret | default('barbican-luna-login', true) }}"

- name: Create kustomization to use update barbican to use luna
hosts: "{{ cifmw_target_hook_host | default('localhost') }}"
tasks:
- name: Create file to customize barbican resource deployed in the control plane
vars:
client_data_secret: "{{ cifmw_hsm_luna_client_data_secret | default('barbican-luna-client-data', true) }}"
login_secret: "{{ cifmw_hsm_login_secret | default('barbican-luna-login', true) }}"
ansible.builtin.copy:
dest: "{{ cifmw_basedir }}/artifacts/manifests/kustomizations/controlplane/93-barbican-luna.yaml"
content: |-
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
namespace: {{ namespace }}
patches:
- target:
kind: OpenStackControlPlane
name: .*
patch: |-
- op: add
path: /spec/barbican/template/globalDefaultSecretStore
value: pkcs11
- op: add
path: /spec/barbican/template/enabledSecretStores
value:
- pkcs11
- op: add
path: /spec/barbican/template/pkcs11
value:
loginSecret: {{ login_secret }}
clientDataSecret: {{ client_data_secret }}
clientDataPath: /usr/local/luna/config
- op: add
path: /spec/barbican/template/customServiceConfig
value: |
[p11_crypto_plugin]
plugin_name = PKCS11
library_path = /usr/local/luna/libs/64/libCryptoki2.so
token_labels = {{ cifmw_hsm_luna_partition }}
mkek_label = {{ cifm_hsm_mkek_label }}
hmac_label = {{ cifm_hsm_hmac_label }}
encryption_mechanism = CKM_AES_GCM
aes_gcm_generate_iv = false
hmac_key_type = CKK_GENERIC_SECRET
hmac_keygen_mechanism = CKM_GENERIC_SECRET_KEY_GEN
hmac_mechanism = CKM_SHA256_HMAC
key_wrap_mechanism = {{ cifmw_hsm_key_wrap_mechanism }}
key_wrap_generate_iv = true
always_set_cka_sensitive = true
os_locking_ok = false
1 change: 1 addition & 0 deletions roles/update_containers/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,4 @@ cifmw_update_containers_manilashares:
# cifmw_update_containers_edpm_image_url:
# cifmw_update_containers_ipa_image_url:
# cifmw_update_containers_edpmnodeexporterimage:
cifmw_update_barbican_custom_tag: ""
4 changes: 2 additions & 2 deletions roles/update_containers/templates/update_containers.j2
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ spec:
aodhEvaluatorImage: {{ cifmw_update_containers_registry }}/{{ cifmw_update_containers_org }}/openstack-aodh-evaluator:{{ cifmw_update_containers_tag }}
aodhListenerImage: {{ cifmw_update_containers_registry }}/{{ cifmw_update_containers_org }}/openstack-aodh-listener:{{ cifmw_update_containers_tag }}
aodhNotifierImage: {{ cifmw_update_containers_registry }}/{{ cifmw_update_containers_org }}/openstack-aodh-notifier:{{ cifmw_update_containers_tag }}
barbicanAPIImage: {{ cifmw_update_containers_registry }}/{{ cifmw_update_containers_org }}/openstack-barbican-api:{{ cifmw_update_containers_tag }}
barbicanAPIImage: {{ cifmw_update_containers_registry }}/{{ cifmw_update_containers_org }}/openstack-barbican-api:{{ cifmw_update_containers_tag }}{{ cifmw_update_barbican_custom_tag }}
barbicanKeystoneListenerImage: {{ cifmw_update_containers_registry }}/{{ cifmw_update_containers_org }}/openstack-barbican-keystone-listener:{{ cifmw_update_containers_tag }}
barbicanWorkerImage: {{ cifmw_update_containers_registry }}/{{ cifmw_update_containers_org }}/openstack-barbican-worker:{{ cifmw_update_containers_tag }}
barbicanWorkerImage: {{ cifmw_update_containers_registry }}/{{ cifmw_update_containers_org }}/openstack-barbican-worker:{{ cifmw_update_containers_tag }}{{ cifmw_update_barbican_custom_tag }}
ceilometerCentralImage: {{ cifmw_update_containers_registry }}/{{ cifmw_update_containers_org }}/openstack-ceilometer-central:{{ cifmw_update_containers_tag }}
ceilometerComputeImage: {{ cifmw_update_containers_registry }}/{{ cifmw_update_containers_org }}/openstack-ceilometer-compute:{{ cifmw_update_containers_tag }}
ceilometerIpmiImage: {{ cifmw_update_containers_registry }}/{{ cifmw_update_containers_org }}/openstack-ceilometer-ipmi:{{ cifmw_update_containers_tag }}
Expand Down