cbd597f395
This commit refactors ansible to use the sysinv-utils for generating overrides files. It also updates CLIs to use command arguments instead of using grep/awk. The current model can easily beak if for example a column is added to the outputted data. Story: 2006590 Task: 36892 Depends-On: https://review.opendev.org/693213/ Signed-off-by: Kristine Bujold <kristine.bujold@windriver.com> Change-Id: Ife65cd95c0f7c0ec431a9298965acab50aac11d7
85 lines
2.8 KiB
YAML
85 lines
2.8 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 copy this file to bootstrap playbook
|
|
# and run it from sysadmin user with same params as the platform restore.
|
|
# Before running remove /etc/platform/.restore_in_progress.
|
|
# E.g.: '
|
|
# cp -f /usr/share/ansible/stx-ansible/playbooks/test/tc_recover_ceph_data.yml
|
|
# /usr/share/ansible/stx-ansible/playbooks/bootstrap/;
|
|
# ansible-playbook
|
|
# /usr/share/ansible/stx-ansible/playbooks/bootstrap/tc_recover_ceph_data.yml
|
|
# -e "initial_backup_dir=/home/sysadmin
|
|
# wipe_ceph_osds=false ansible_become_pass=<password> admin_password=<password>
|
|
# backup_filename=<backup.tgz>"'
|
|
#
|
|
# Note: Test case works only when executed localy.
|
|
|
|
- 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
|
|
|
|
- name: Set default folder facts
|
|
set_fact:
|
|
staging_dir: /scratch
|
|
platform_path: /opt/platform
|
|
target_backup_dir: /scratch
|
|
|
|
# Get system_type
|
|
- name: Retrieve system type
|
|
shell: source /etc/platform/platform.conf; echo $system_type
|
|
register: system_type_result
|
|
|
|
- name: Fail if system type is not defined
|
|
fail:
|
|
msg: "system_type is missing in /etc/platform/platform.conf"
|
|
when: system_type_result.stdout_lines|length == 0
|
|
|
|
- name: Set system type config path fact
|
|
set_fact:
|
|
system_type: "{{ system_type_result.stdout_lines[0] }}"
|
|
|
|
# Get SW_VERSION
|
|
- name: Retrieve software version number
|
|
# lookup module does not work with /etc/build.info as it does not have ini
|
|
# format. Resort to shell source.
|
|
shell: source /etc/build.info; echo $SW_VERSION
|
|
register: sw_version_result
|
|
|
|
- name: Fail if software version is not defined
|
|
fail:
|
|
msg: "SW_VERSION is missing in /etc/build.info"
|
|
when: sw_version_result.stdout_lines|length == 0
|
|
|
|
- name: Set facts
|
|
set_fact:
|
|
software_version: "{{ sw_version_result.stdout_lines[0] }}"
|
|
|
|
- name: Retrieve management IP
|
|
shell: >-
|
|
source /etc/platform/openrc;
|
|
system host-show controller-0 --format value --column mgmt_ip
|
|
register: mgmt_ip
|
|
|
|
- name: Set derived facts for subsequent tasks/roles
|
|
set_fact:
|
|
puppet_permdir: "{{ platform_path }}/puppet/{{ software_version }}"
|
|
derived_network_params:
|
|
'controller_0_address': "{{ mgmt_ip.stdout_lines[0] }}"
|
|
|
|
roles:
|
|
- { role: recover-ceph-data, become: yes }
|