|
| 1 | +# barbican_adoption |
| 2 | + |
| 3 | +Role to support Barbican service adoption from OpenStack 17.1 to RHOSO 18 while preserving Hardware Security Module (HSM) integration, specifically designed for Proteccio HSM environments. |
| 4 | + |
| 5 | +## Overview |
| 6 | + |
| 7 | +This role implements a comprehensive adoption framework that: |
| 8 | +- Migrates Barbican database from source OSP 17.1 environment |
| 9 | +- Preserves HSM configuration and connectivity |
| 10 | +- Deploys Barbican in target RHOSO 18 environment |
| 11 | +- Validates successful adoption and HSM integration |
| 12 | + |
| 13 | +## Features |
| 14 | + |
| 15 | +- **Database Migration**: Automated backup and migration of Barbican database |
| 16 | +- **HSM Preservation**: Maintains Proteccio HSM configuration and secrets |
| 17 | +- **Service Migration**: Orchestrated shutdown of source services and deployment in target |
| 18 | +- **Validation**: Comprehensive verification of adoption success |
| 19 | +- **Rollback Support**: Backup creation for potential rollback scenarios |
| 20 | + |
| 21 | +## Prerequisites |
| 22 | + |
| 23 | +1. Access to source OSP 17.1 environment with Barbican + Proteccio HSM |
| 24 | +2. Target RHOSO 18 environment with OpenShift cluster |
| 25 | +3. Proteccio HSM certificates and configuration files |
| 26 | +4. Database access credentials for source environment |
| 27 | + |
| 28 | +## Variables |
| 29 | + |
| 30 | +### Required Variables |
| 31 | + |
| 32 | +- `cifmw_barbican_adoption_source_db_host`: Source database hostname/IP |
| 33 | +- `cifmw_barbican_adoption_source_db_password`: Source database password |
| 34 | +- `cifmw_openshift_kubeconfig`: Path to OpenShift kubeconfig file |
| 35 | + |
| 36 | +### HSM Configuration (when HSM enabled) |
| 37 | + |
| 38 | +- `cifmw_barbican_adoption_proteccio_partition`: HSM partition/token name |
| 39 | +- `cifmw_barbican_adoption_proteccio_mkek_label`: Master key encryption key label |
| 40 | +- `cifmw_barbican_adoption_proteccio_hmac_label`: HMAC key label |
| 41 | + |
| 42 | +### Optional Variables |
| 43 | + |
| 44 | +- `cifmw_barbican_adoption_hsm_enabled`: Enable HSM support (default: false) |
| 45 | +- `cifmw_barbican_adoption_backup_enabled`: Create database backup (default: true) |
| 46 | +- `cifmw_barbican_adoption_preserve_jobs`: Preserve migration jobs (default: false) |
| 47 | +- `cifmw_barbican_adoption_debug`: Enable debug logging (default: false) |
| 48 | + |
| 49 | +See `defaults/main.yml` for complete variable list. |
| 50 | + |
| 51 | +## Usage |
| 52 | + |
| 53 | +### Basic Adoption (No HSM) |
| 54 | + |
| 55 | +```yaml |
| 56 | +- name: Adopt Barbican service |
| 57 | + ansible.builtin.include_role: |
| 58 | + name: barbican_adoption |
| 59 | + vars: |
| 60 | + cifmw_barbican_adoption_source_db_host: "192.168.1.100" |
| 61 | + cifmw_barbican_adoption_source_db_password: "secret123" |
| 62 | +``` |
| 63 | +
|
| 64 | +### Proteccio HSM Adoption |
| 65 | +
|
| 66 | +```yaml |
| 67 | +- name: Adopt Barbican with Proteccio HSM |
| 68 | + ansible.builtin.include_role: |
| 69 | + name: barbican_adoption |
| 70 | + vars: |
| 71 | + cifmw_barbican_adoption_source_db_host: "192.168.1.100" |
| 72 | + cifmw_barbican_adoption_source_db_password: "secret123" |
| 73 | + cifmw_barbican_adoption_hsm_enabled: true |
| 74 | + cifmw_barbican_adoption_hsm_type: "proteccio" |
| 75 | + cifmw_barbican_adoption_proteccio_partition: "barbican_partition" |
| 76 | + cifmw_barbican_adoption_proteccio_mkek_label: "mkek_2024" |
| 77 | + cifmw_barbican_adoption_proteccio_hmac_label: "hmac_2024" |
| 78 | +``` |
| 79 | +
|
| 80 | +### Using with Adoption Playbook |
| 81 | +
|
| 82 | +```bash |
| 83 | +ansible-playbook playbooks/adoption/barbican-proteccio.yml \ |
| 84 | + -e osp_17_controller_host=192.168.1.100 \ |
| 85 | + -e barbican_db_password=secret123 \ |
| 86 | + -e hsm_partition=barbican_partition \ |
| 87 | + -e hsm_mkek_label=mkek_2024 \ |
| 88 | + -e hsm_hmac_label=hmac_2024 |
| 89 | +``` |
| 90 | + |
| 91 | +## Integration with CI Framework |
| 92 | + |
| 93 | +This role integrates with the existing ci-framework adoption infrastructure: |
| 94 | + |
| 95 | +1. **Hooks Integration**: Works with `barbican-enable-proteccio.yml` hook |
| 96 | +2. **Adoption Framework**: Leverages existing `adoption_osp_deploy` role |
| 97 | +3. **Kustomization**: Creates appropriate Kubernetes manifests |
| 98 | +4. **Scenarios**: Can be used with adoption scenarios |
| 99 | + |
| 100 | +## Architecture |
| 101 | + |
| 102 | +The adoption process follows these phases: |
| 103 | + |
| 104 | +1. **Validation**: Verify prerequisites and connectivity |
| 105 | +2. **Backup**: Create database and configuration backups |
| 106 | +3. **Migration**: Stop source services and migrate database |
| 107 | +4. **HSM Configuration**: Preserve and configure HSM integration |
| 108 | +5. **Deployment**: Deploy Barbican in target environment |
| 109 | +6. **Verification**: Validate adoption success |
| 110 | +7. **Cleanup**: Remove temporary files and old backups |
| 111 | + |
| 112 | +## Error Handling |
| 113 | + |
| 114 | +- Database migration failures trigger automatic rollback |
| 115 | +- HSM connectivity issues are validated before deployment |
| 116 | +- Comprehensive logging for troubleshooting |
| 117 | +- Backup creation ensures data protection |
| 118 | + |
| 119 | +## Limitations |
| 120 | + |
| 121 | +- Currently supports Proteccio HSM only (Luna HSM can be added) |
| 122 | +- Requires manual network connectivity between environments |
| 123 | +- Database migration requires temporary downtime |
| 124 | + |
| 125 | +## Examples |
| 126 | + |
| 127 | +See `playbooks/adoption/barbican-proteccio.yml` and `scenarios/adoption/uni07eta.yml` for complete usage examples. |
| 128 | + |
| 129 | +## Testing |
| 130 | + |
| 131 | +The role can be tested using the adoption scenario: |
| 132 | + |
| 133 | +```bash |
| 134 | +ansible-playbook deploy-osp-adoption.yml \ |
| 135 | + -e @scenarios/adoption/uni07eta.yml \ |
| 136 | + -e osp_17_controller_host=192.168.1.100 |
| 137 | +``` |
| 138 | + |
| 139 | +## Contributing |
| 140 | + |
| 141 | +When extending this role: |
| 142 | +1. Follow existing variable naming conventions (`cifmw_barbican_adoption_*`) |
| 143 | +2. Add appropriate validation in `validate_prerequisites.yml` |
| 144 | +3. Update documentation and examples |
| 145 | +4. Test with both HSM and non-HSM scenarios |
0 commit comments