Skip to content

Commit f24e747

Browse files
stuggiclaude
andcommitted
[b/r] Improve restore playbook: reorder steps, better output
- Move infrastructure ready wait before GaleraBackup restore (Step 5/6 swap) so infra is up before restoring GaleraBackup CRs - Show RabbitMQUser status table after credential restore - Print annotation removal command before executing it Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 3ef7f86 commit f24e747

1 file changed

Lines changed: 55 additions & 47 deletions

File tree

docs/dev/backup-restore/restore/restore-openstack.yaml

Lines changed: 55 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
# 2. Foundation resources (Secrets, ConfigMaps, NADs)
1010
# 3. Infrastructure CRs (OpenStackVersion, MariaDBAccount, etc.)
1111
# 4. OpenStackControlPlane (with infrastructure-only staging)
12-
# 5. GaleraBackup CRs (backup configuration)
13-
# 6. Wait for infrastructure (Galera, OVN, RabbitMQ) to be ready
12+
# 5. Wait for infrastructure (Galera, OVN, RabbitMQ) to be ready
13+
# 6. GaleraBackup CRs (backup configuration)
1414
# 7. Database restore (create GaleraRestore CRs, exec restore)
1515
# 8. RabbitMQ credential restore (restore old secrets to temp ns, copy, create RabbitMQUser CRs)
1616
# 9. Resume full deployment (remove staging annotation)
@@ -420,48 +420,8 @@
420420
step_name: "Step 4 (ControlPlane restore)"
421421

422422
# ========================================
423-
# Step 5: Restore GaleraBackup CRs (Order 40)
423+
# Step 5: Wait for Infrastructure Ready
424424
# ========================================
425-
- name: Render backup config restore
426-
ansible.builtin.template:
427-
src: "{{ playbook_dir }}/templates/05-restore-order-40-backup-config.yaml.j2"
428-
dest: "{{ rendered_dir.path }}/05-restore-order-40-backup-config.yaml"
429-
430-
- name: "Next: Step 5 - Restore GaleraBackup CRs"
431-
ansible.builtin.debug:
432-
msg: "{{ lookup('file', rendered_dir.path + '/05-restore-order-40-backup-config.yaml').splitlines() }}"
433-
when: not (auto_ack | bool)
434-
435-
- name: Pause after controlplane restore
436-
ansible.builtin.pause:
437-
prompt: >-
438-
Step 4 complete: OpenStackControlPlane restored (staged).
439-
Press Enter to continue, or Ctrl+C then 'A' to abort
440-
when: not (auto_ack | bool)
441-
442-
- name: Create backup config restore
443-
ansible.builtin.shell: |
444-
oc apply -f {{ rendered_dir.path }}/05-restore-order-40-backup-config.yaml
445-
changed_when: true
446-
447-
- name: Wait for backup config restore
448-
ansible.builtin.include_tasks:
449-
file: wait-for-restore.yaml
450-
vars:
451-
restore_name: "openstack-restore-40-backup-{{ restore_suffix }}"
452-
step_name: "Step 5 (GaleraBackup restore)"
453-
454-
# ========================================
455-
# Step 6: Wait for Infrastructure Ready
456-
# ========================================
457-
- name: Pause after GaleraBackup restore
458-
ansible.builtin.pause:
459-
prompt: >-
460-
Step 5 complete: GaleraBackup CRs restored.
461-
Next: Step 6 - Wait for infrastructure ready (Galera, OVN, RabbitMQ, Memcached).
462-
Press Enter to continue, or Ctrl+C then 'A' to abort
463-
when: not (auto_ack | bool)
464-
465425
- name: Wait for OpenStackControlPlane infrastructure ready
466426
ansible.builtin.shell: |
467427
oc wait openstackcontrolplane -n {{ openstack_namespace }} --all \
@@ -481,20 +441,52 @@
481441
register: galera_pod_phases
482442
changed_when: false
483443

484-
- name: Print Step 6 result
444+
- name: Print Step 5 result
485445
ansible.builtin.debug:
486446
msg:
487447
- "Infrastructure is ready"
488448
- "ControlPlane: {{ ctlplane_name.stdout }}"
489449
- "Galera pod phases: {{ galera_pod_phases.stdout }}"
490450

491451
# ========================================
492-
# Step 7: Database Restore
452+
# Step 6: Restore GaleraBackup CRs (Order 40)
493453
# ========================================
454+
- name: Render backup config restore
455+
ansible.builtin.template:
456+
src: "{{ playbook_dir }}/templates/05-restore-order-40-backup-config.yaml.j2"
457+
dest: "{{ rendered_dir.path }}/05-restore-order-40-backup-config.yaml"
458+
459+
- name: "Next: Step 6 - Restore GaleraBackup CRs"
460+
ansible.builtin.debug:
461+
msg: "{{ lookup('file', rendered_dir.path + '/05-restore-order-40-backup-config.yaml').splitlines() }}"
462+
when: not (auto_ack | bool)
463+
494464
- name: Pause after infrastructure ready
495465
ansible.builtin.pause:
496466
prompt: >-
497-
Step 6 complete: Infrastructure is ready (Galera, OVN, RabbitMQ, Memcached).
467+
Step 5 complete: Infrastructure is ready (Galera, OVN, RabbitMQ, Memcached).
468+
Press Enter to continue, or Ctrl+C then 'A' to abort
469+
when: not (auto_ack | bool)
470+
471+
- name: Create backup config restore
472+
ansible.builtin.shell: |
473+
oc apply -f {{ rendered_dir.path }}/05-restore-order-40-backup-config.yaml
474+
changed_when: true
475+
476+
- name: Wait for backup config restore
477+
ansible.builtin.include_tasks:
478+
file: wait-for-restore.yaml
479+
vars:
480+
restore_name: "openstack-restore-40-backup-{{ restore_suffix }}"
481+
step_name: "Step 6 (GaleraBackup restore)"
482+
483+
# ========================================
484+
# Step 7: Database Restore
485+
# ========================================
486+
- name: Pause after GaleraBackup restore
487+
ansible.builtin.pause:
488+
prompt: >-
489+
Step 6 complete: GaleraBackup CRs restored.
498490
Next: Step 7 - Database restore (GaleraRestore).
499491
Press Enter to continue, or Ctrl+C then 'A' to abort
500492
when: not (auto_ack | bool)
@@ -673,9 +665,21 @@
673665
loop: "{{ rabbitmq_clusters }}"
674666
changed_when: true
675667

668+
- name: Wait for RabbitMQUser CRs to be ready
669+
ansible.builtin.shell: |
670+
oc wait rabbitmquser --all -n {{ openstack_namespace }} --for=jsonpath='{.status.conditions[0].status}'=True --timeout=120s
671+
changed_when: false
672+
failed_when: false
673+
674+
- name: Get RabbitMQUser status
675+
ansible.builtin.shell: |
676+
oc get rabbitmquser -n {{ openstack_namespace }}
677+
register: rabbitmquser_status
678+
changed_when: false
679+
676680
- name: Print Step 8 result
677681
ansible.builtin.debug:
678-
msg: "RabbitMQ user credentials restored"
682+
msg: "{{ rabbitmquser_status.stdout_lines }}"
679683

680684
# ========================================
681685
# Step 9: Resume Full Deployment
@@ -688,6 +692,10 @@
688692
Press Enter to continue, or Ctrl+C then 'A' to abort
689693
when: not (auto_ack | bool)
690694

695+
- name: Print annotation removal command
696+
ansible.builtin.debug:
697+
msg: "oc annotate openstackcontrolplane {{ ctlplane_name.stdout }} -n {{ openstack_namespace }} core.openstack.org/deployment-stage-"
698+
691699
- name: Remove deployment-stage annotation
692700
ansible.builtin.shell: |
693701
oc annotate openstackcontrolplane {{ ctlplane_name.stdout }} \

0 commit comments

Comments
 (0)