Skip to content

Commit 2bb639e

Browse files
stuggiclaude
andcommitted
[b/r] Split Ansible roles: deploy_minio, openshift_adp, cifmw_backup_restore
Split the monolithic cifmw_backup_restore role into three independent roles: - deploy_minio: S3 storage backend (cifmw_deploy_minio_* vars, compatible with ci-framework PR #3793). Uses Deployment (not bare Pod), includes bucket creation, service account, readiness wait. - openshift_adp: OADP operator installation and configuration (cifmw_openshift_adp_* vars). DPA, cloud-credentials, VolumeSnapshotClass, BSL verification. - cifmw_backup_restore: Backup/restore/cleanup lifecycle only. Removed setup_minio and setup_oadp actions. Updated end-to-end test playbook to chain the three roles. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent a81c68c commit 2bb639e

9 files changed

Lines changed: 288 additions & 161 deletions

File tree

docs/dev/backup-restore/role/cifmw_backup_restore/defaults/main.yml

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,3 @@ cifmw_backup_restore_pin_pvcs: false
4545
# Cleanup
4646
cifmw_backup_restore_cleanup_ctlplane: true
4747
cifmw_backup_restore_cleanup_dataplane: true
48-
49-
# MinIO Setup (dev/test only)
50-
cifmw_backup_restore_minio_namespace: minio
51-
cifmw_backup_restore_minio_storage_size: 10Gi
52-
cifmw_backup_restore_minio_storage_class: ""
53-
cifmw_backup_restore_minio_root_user: minio
54-
cifmw_backup_restore_minio_root_password: minio123
55-
cifmw_backup_restore_minio_bucket_name: velero
56-
57-
# OADP Setup
58-
cifmw_backup_restore_oadp_channel: stable
59-
cifmw_backup_restore_oadp_enable_node_agent: true
60-
# cifmw_backup_restore_minio_access_key_id: REQUIRED for setup_oadp
61-
# cifmw_backup_restore_minio_secret_access_key: REQUIRED for setup_oadp

docs/dev/backup-restore/role/cifmw_backup_restore/tasks/main.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
- name: Validate action parameter
1818
ansible.builtin.fail:
1919
msg: >-
20-
cifmw_backup_restore_action must be set to one of: setup_minio, setup_oadp, backup, restore, cleanup.
20+
cifmw_backup_restore_action must be set to one of: backup, restore, cleanup.
2121
Example: -e cifmw_backup_restore_action=backup
22-
when: cifmw_backup_restore_action not in ['setup_minio', 'setup_oadp', 'backup', 'restore', 'cleanup']
22+
when: cifmw_backup_restore_action not in ['backup', 'restore', 'cleanup']
2323

2424
- name: Run {{ cifmw_backup_restore_action }}
2525
ansible.builtin.include_tasks: "{{ cifmw_backup_restore_action }}.yml"
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
---
2+
# End-to-end backup/restore test playbook
3+
#
4+
# Runs the full lifecycle:
5+
# 1. Install dependencies (MinIO + OADP)
6+
# 2. Create backup
7+
# 3. Cleanup namespace
8+
# 4. Restore from backup
9+
#
10+
# Each step can be enabled/disabled independently for iterative testing.
11+
#
12+
# Prerequisites:
13+
# - OpenStack control plane deployed and healthy
14+
# - OpenStackBackupConfig CR created (for backup labeling)
15+
#
16+
# Usage:
17+
# # Full run:
18+
# ansible-playbook cifmw_backup_restore_test.yaml
19+
#
20+
# # Install deps only:
21+
# ansible-playbook cifmw_backup_restore_test.yaml \
22+
# -e backup=false -e cleanup=false -e restore=false
23+
#
24+
# # Backup only (deps already installed):
25+
# ansible-playbook cifmw_backup_restore_test.yaml \
26+
# -e install_deps=false -e cleanup=false -e restore=false
27+
#
28+
# # Cleanup + restore (backup already done):
29+
# ansible-playbook cifmw_backup_restore_test.yaml \
30+
# -e install_deps=false -e backup=false \
31+
# -e backup_timestamp=20260323-144546
32+
#
33+
# # Restore only (cleanup already done):
34+
# ansible-playbook cifmw_backup_restore_test.yaml \
35+
# -e install_deps=false -e backup=false -e cleanup=false \
36+
# -e backup_timestamp=20260323-144546
37+
#
38+
# # With PVC pinning (WaitForFirstConsumer storage):
39+
# ansible-playbook cifmw_backup_restore_test.yaml \
40+
# -e cifmw_backup_restore_pin_pvcs=true
41+
42+
- name: Backup and Restore end-to-end test
43+
hosts: localhost
44+
gather_facts: false
45+
46+
vars:
47+
install_deps: true
48+
backup: true
49+
cleanup: true
50+
restore: true
51+
# backup_timestamp: set this when running restore without backup step
52+
53+
tasks:
54+
# ========================================
55+
# Step 1: Install dependencies
56+
# ========================================
57+
- name: Setup MinIO
58+
ansible.builtin.include_role:
59+
name: deploy_minio
60+
when: install_deps | bool
61+
62+
- name: Setup OADP
63+
ansible.builtin.include_role:
64+
name: openshift_adp
65+
vars:
66+
cifmw_openshift_adp_s3_access_key: "{{ cifmw_deploy_minio_access_key }}"
67+
cifmw_openshift_adp_s3_secret_key: "{{ cifmw_deploy_minio_secret_key }}"
68+
when: install_deps | bool
69+
70+
# ========================================
71+
# Step 2: Create backup
72+
# ========================================
73+
- name: Create backup
74+
ansible.builtin.include_role:
75+
name: cifmw_backup_restore
76+
vars:
77+
cifmw_backup_restore_action: backup
78+
cifmw_backup_restore_auto_ack: true
79+
when: backup | bool
80+
81+
- name: Print backup timestamp
82+
ansible.builtin.debug:
83+
msg: "Backup completed with timestamp: {{ cifmw_backup_restore_backup_name_suffix }}"
84+
when: backup | bool
85+
86+
# ========================================
87+
# Step 3: Cleanup namespace
88+
# ========================================
89+
- name: Cleanup
90+
ansible.builtin.include_role:
91+
name: cifmw_backup_restore
92+
vars:
93+
cifmw_backup_restore_action: cleanup
94+
cifmw_backup_restore_auto_ack: true
95+
when: cleanup | bool
96+
97+
# ========================================
98+
# Step 4: Restore from backup
99+
# ========================================
100+
- name: Restore
101+
ansible.builtin.include_role:
102+
name: cifmw_backup_restore
103+
vars:
104+
cifmw_backup_restore_action: restore
105+
cifmw_backup_restore_backup_timestamp: "{{ backup_timestamp | default(cifmw_backup_restore_backup_name_suffix) }}"
106+
cifmw_backup_restore_auto_ack: true
107+
when: restore | bool
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
# Copyright Red Hat, Inc.
3+
# All Rights Reserved.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License"); you may
6+
# not use this file except in compliance with the License. You may obtain
7+
# a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14+
# License for the specific language governing permissions and limitations
15+
# under the License.
16+
17+
# All variables intended for modification should be placed in this file.
18+
# All variables within this role should have a prefix of "cifmw_deploy_minio"
19+
20+
cifmw_deploy_minio_namespace: minio
21+
cifmw_deploy_minio_storage_size: 10Gi
22+
cifmw_deploy_minio_storage_class: ""
23+
cifmw_deploy_minio_root_user: minio
24+
cifmw_deploy_minio_root_password: minio123
25+
cifmw_deploy_minio_bucket_name: velero
26+
cifmw_deploy_minio_image: quay.io/minio/minio:latest
27+
cifmw_deploy_minio_create_service_account: true
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
galaxy_info:
3+
role_name: deploy_minio
4+
namespace: cifmw
5+
author: Red Hat
6+
description: Deploy MinIO as S3-compatible storage backend
7+
license: Apache-2.0
8+
min_ansible_version: "2.11"

0 commit comments

Comments
 (0)