ansible-playbooks/playbookconfig/src/playbooks/test/tc_recover_ceph_data.yml
Ovidiu Poncea 038ef7ff35 B&R: Recover Ceph monitor data at restore on AIO-SX
This commit implements the recovery procedure for Ceph monitor data
as the last step in the restore procedure.

This procedure involves the following steps:
1. Recover ceph.conf from backup tarball;
2. Create folder for every ceph osd under '/var/lib/ceph/osd'
   and mount in there the ceph osds by parsing the 'ceph-disk list'
   output e.g ceph-disk list 2>/dev/null
/dev/sdc :
 /dev/sdc1 ceph data, active, cluster ceph, osd.1,
 osd uuid 7ce96cba-ee43-4616-966c-652e1d7da80a, journal /dev/sdc2
 /dev/sdc2 ceph journal, for /dev/sdc1
3. Create a ceph-mon logical volume (ceph-mon-lv) with 'lvcreate'
4. Format ceph-mon-lv with ext4 file system
5. Mount ceph-mon-lv in /var/lib/ceph/mon
6. Create a ceph-mon fs with:
   ceph-mon --mkfs -i controller-0
7. Start ceph-mon
8. Collect data from osds (store.db file) using "ceph-objectstore-tool"
   to create a new store.db
8. Stop ceph-mon
9. Copy the newly created store.db over the one in /var/lib/ceph/mon
10. Start ceph-mon/ceph-mgr/osds

Co-Authored-By: Elena Taivan <elena.taivan@windriver.com>
Change-Id: I96c1c749dfa5a2ce92bce12469ac6ec5e6051e9a
Story: 2004761
Task: 36200
Depends-On: Id56789db11c1fb180608975a962baf19514d8da6
Signed-off-by: Ovidiu Poncea <ovidiu.poncea@windriver.com>
2019-09-27 17:00:41 +03:00

35 lines
1.1 KiB
YAML

---
#
# Copyright (c) 2019 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
# Role of this playbook is to allow easy testing of ceph recovery process.
# To run it make sure that the normal platform restore playbook was
# executed with wipe_ceph_osds=false. Then run this playbook from sysadmin
# user with same params as the platform restore. E.g.: ' ansible-playbook
# /usr/share/ansible/stx-ansible/playbooks/bootstrap/tc_recover_ceph_data.yml
# -e "wipe_ceph_osds=false ansible_become_pass=<password> admin_password=<password>
# backup_filename=<backup.tgz>"'
- hosts: localhost
gather_facts: no
vars_files:
- host_vars/default.yml
pre_tasks:
- name: Fail if backup_filename is not defined or set
fail:
msg: "Mandatory configuration parameter backup_filename is not defined or set."
when: backup_filename is not defined or backup_filename is none
# Put the backup tarball in /scratch
- name: Set staging and target backup dirs
set_fact:
staging_dir: /scratch
target_backup_dir: /scratch
roles:
- { role: recover-ceph-data, become: yes }