Skip to content

Commit d3b3d73

Browse files
author
Mauricio Harley
committed
Simply the way Proteccio is setup to be used with Barbican.
Addresses last comments. Signed-off-by: Mauricio Harley <[email protected]>
1 parent 056cd66 commit d3b3d73

File tree

11 files changed

+74
-571
lines changed

11 files changed

+74
-571
lines changed

tests/config.env.sample

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,5 @@
1-
# Sample configuration file for HSM adoption automation
2-
# Copy this file to config.env and customize for your environment
1+
# Minimal environment configuration for HSM adoption
2+
# Copy this to config.env and modify as needed
33

4-
# Base directory for Proteccio adoption files
5-
# Default uses current user's home directory
6-
PROTECCIO_BASE_DIR="$HOME/adopt_proteccio"
7-
8-
# Path to the Proteccio HSM Ansible role
9-
PROTECCIO_ROLES_DIR="$PROTECCIO_BASE_DIR/roles/ansible-role-rhoso-proteccio-hsm"
10-
11-
# Directory containing Proteccio client certificates and configuration files
12-
PROTECCIO_FILES_DIR="$PROTECCIO_BASE_DIR/proteccio_files"
13-
14-
# Ansible inventory file for the adoption
15-
INVENTORY_FILE="inventory.proteccio.yaml"
16-
17-
# Ansible playbook file for the adoption
18-
PLAYBOOK_FILE="playbooks/barbican_hsm_adoption.yml"
19-
20-
# Expected user account (user that should run the script)
21-
EXPECTED_USER="stack"
22-
23-
# Additional Ansible variables (optional)
24-
# export ANSIBLE_HOST_KEY_CHECKING=False
25-
# export ANSIBLE_TIMEOUT=60
4+
# HSM Configuration
5+
BARBICAN_HSM_ENABLED=false

tests/hsm_vars/common.yml

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,3 @@
11
---
2-
# Common HSM adoption variables (vendor-agnostic)
3-
# All values should be overridden by user-specific configurations
4-
5-
enable_hsm_integration: true
6-
enable_phased_hsm_adoption: false
7-
8-
# Target environment configuration (user must override)
9-
target_kubeconfig_path: "{{ user_kubeconfig_path | default('/home/user/.kube/config') }}"
10-
oc_binary_path: "{{ user_oc_path | default('/usr/local/bin') }}"
11-
target_namespace: "{{ user_target_namespace | default('openstack') }}"
12-
13-
# Common HSM settings
14-
barbican_hsm_enabled: true
15-
barbican_default_secret_store: "{{ user_default_secret_store | default('pkcs11') }}"
16-
barbican_enabled_secret_stores: "{{ user_enabled_stores | default(['simple_crypto', 'pkcs11']) }}"
17-
18-
# Custom image settings (must be set by user)
19-
use_custom_barbican_images: "{{ user_enable_custom_images | default(true) }}"
20-
barbican_dest_image_registry: "{{ user_image_registry | default('CHANGE_ME_REGISTRY') }}"
21-
barbican_dest_image_namespace: "{{ user_image_namespace | default('CHANGE_ME_NAMESPACE') }}"
22-
barbican_dest_image_tag: "{{ user_image_tag | default('CHANGE_ME_TAG') }}"
23-
24-
# Adoption control
25-
create_adoption_summary: "{{ user_create_summary | default(true) }}"
26-
summary_output_path: "{{ user_summary_path | default('/tmp/barbican_hsm_adoption_summary.md') }}"
27-
28-
# Internal API network (user configurable)
29-
internalapi_prefix: "{{ user_internal_api_prefix | default('172.17.0') }}"
2+
# Common HSM variables
3+
internalapi_prefix: "172.17.0"

tests/hsm_vars/proteccio.yml

Lines changed: 2 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,3 @@
11
---
2-
# Proteccio-specific HSM configuration
3-
# All values should be overridden by user-specific configurations
4-
5-
hsm_vendor: "proteccio"
6-
7-
# Proteccio HSM connection settings (user must configure)
8-
proteccio_hsm_tokens: "{{ user_proteccio_tokens | default(['CHANGE_ME_TOKEN']) }}"
9-
proteccio_mkek_name: "{{ user_proteccio_mkek | default('CHANGE_ME_MKEK') }}"
10-
proteccio_hmac_name: "{{ user_proteccio_hmac | default('CHANGE_ME_HMAC') }}"
11-
proteccio_library_path: "{{ user_proteccio_lib_path | default('/opt/tw_proteccio/lib/libnethsm.so') }}"
12-
proteccio_login_password: "{{ user_proteccio_password | default('CHANGE_ME_PASSWORD') }}"
13-
14-
# Proteccio client configuration (user must provide)
15-
proteccio_client_iso: "{{ user_proteccio_iso | default('CHANGE_ME_ISO_FILENAME') }}"
16-
proteccio_config_file: "{{ user_proteccio_config | default('proteccio.rc') }}"
17-
18-
# Proteccio secrets in target environment (user configurable)
19-
proteccio_login_secret: "{{ user_proteccio_login_secret | default('hsm-login') }}"
20-
proteccio_client_data_secret: "{{ user_proteccio_data_secret | default('proteccio-data') }}"
21-
proteccio_client_data_path: "{{ user_proteccio_data_path | default('/etc/proteccio') }}"
22-
23-
# Proteccio custom images (user must configure)
24-
barbican_dest_image_namespace: "{{ user_image_namespace | default('CHANGE_ME_NAMESPACE') }}"
25-
barbican_dest_image_tag: "{{ user_image_tag | default('CHANGE_ME_TAG') }}"
26-
barbican_api_image_name: "{{ user_api_image_name | default('openstack-barbican-api') }}"
27-
barbican_worker_image_name: "{{ user_worker_image_name | default('openstack-barbican-worker') }}"
28-
29-
# File paths (user must override with actual paths)
30-
proteccio_certs_path: "{{ user_proteccio_certs_path | default('CHANGE_ME_CERTS_PATH') }}"
31-
proteccio_config_path: "{{ user_proteccio_config_path | default('CHANGE_ME_CONFIG_PATH') }}"
32-
proteccio_iso_path: "{{ user_proteccio_iso_path | default('CHANGE_ME_ISO_PATH') }}"
33-
34-
# Ansible role configuration (user configurable)
35-
proteccio_hsm_role_name: "{{ user_proteccio_role | default('ansible-role-rhoso-proteccio-hsm') }}"
36-
37-
# Replica configuration (user configurable)
38-
barbican_api_replicas: "{{ user_api_replicas | default(2) }}"
39-
barbican_worker_replicas: "{{ user_worker_replicas | default(2) }}"
40-
barbican_keystone_listener_replicas: "{{ user_keystone_replicas | default(2) }}"
2+
# Minimal Proteccio HSM configuration
3+
barbican_hsm_enabled: true

tests/hsm_vars/user_config.yml.sample

Lines changed: 0 additions & 67 deletions
This file was deleted.

tests/inventory.proteccio.yaml

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,5 @@
11
---
2-
# Inventory for OpenStack Proteccio Adoption Role
3-
# Use this inventory for HSM-enabled barbican_adoption role
4-
# For standard dp-adopt framework, use inventory.yaml instead
5-
62
all:
73
hosts:
84
localhost:
9-
ansible_connection: local
10-
ansible_python_interpreter: "{{ ansible_playbook_python }}"
11-
12-
children:
13-
adoption:
14-
hosts:
15-
localhost:
5+
ansible_connection: local
Lines changed: 5 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,9 @@
11
---
2-
# Main playbook for Barbican adoption with HSM integration (vendor-agnostic)
3-
# OpenStack 17.1 to RHOSO 18 adoption
4-
5-
- name: Barbican Adoption with HSM Integration
2+
- name: Barbican HSM Adoption
63
hosts: localhost
74
connection: local
8-
gather_facts: true
9-
become: false
10-
11-
vars: {}
12-
# Override default variables here if needed
13-
# source_undercloud_host: "your-undercloud-host"
14-
# source_controller_host: "your-controller-host"
15-
# target_namespace: "openstack"
16-
# barbican_simple_crypto_kek: "your-custom-kek"
17-
18-
pre_tasks:
19-
- name: Verify environment prerequisites
20-
block:
21-
- name: Check if running as correct user
22-
ansible.builtin.fail:
23-
msg: "This playbook should be run as the stack user"
24-
when: ansible_user_id != "stack"
25-
26-
- name: Verify oc/oc access
27-
ansible.builtin.command: oc cluster-info
28-
register: cluster_check
29-
failed_when: cluster_check.rc != 0
30-
31-
- name: Check OpenShift/Kubernetes cluster access
32-
ansible.builtin.command: "oc get namespace {{ target_namespace | default('openstack') }}"
33-
register: namespace_check
34-
changed_when: false
35-
failed_when: namespace_check.rc != 0
36-
5+
gather_facts: false
6+
vars_files:
7+
- hsm_vars/proteccio.yml
378
roles:
38-
- role: barbican_adoption
39-
vars:
40-
enable_hsm_integration: true
41-
hsm_vendor: "{{ hsm_vendor | default('proteccio') }}"
42-
43-
post_tasks:
44-
- name: Display completion summary
45-
ansible.builtin.debug:
46-
msg: |
47-
===============================================
48-
ADOPTION COMPLETED SUCCESSFULLY!
49-
===============================================
50-
51-
Barbican adoption with HSM integration has been completed.
52-
53-
Key achievements:
54-
- Database adopted with {{ adopted_secrets_count | default('N/A') }} secrets
55-
- HSM-enabled custom images deployed
56-
- HSM configuration applied
57-
- API functionality verified
58-
59-
Check the generated summary file for detailed results.
60-
===============================================
61-
62-
handlers:
63-
- name: Clean up temporary files
64-
ansible.builtin.file:
65-
path: "{{ item }}"
66-
state: absent
67-
loop:
68-
- "{{ backup_dir }}/temp_*"
69-
listen: "cleanup"
9+
- barbican_adoption

tests/playbooks/hsm/hsm_adoption.yml

Lines changed: 0 additions & 54 deletions
This file was deleted.

0 commit comments

Comments
 (0)