Restructure Ansible playbooks repo

This commit moves all the Ansible playbooks from "bootstrap"
and "backup-restore" folder into "playbooks" folder and makes
necessary changes to the paths in the files.

Tests done:
  - remote and local bootstrap controller-0
  - remote and local backup
  - remote and local restore_platform

Story: 2004761
Task: 36571

Change-Id: I2c7e2035bab4d32ba33d32dc575f3edd9565f82b
Signed-off-by: Wei Zhou <wei.zhou@windriver.com>
This commit is contained in:
Wei Zhou 2019-09-17 15:57:32 -04:00
parent 2f59acce07
commit 6e6e564a4f
54 changed files with 76 additions and 92 deletions

View File

@ -1,52 +0,0 @@
---
#
# Copyright (c) 2019 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
#
# Default directory where user override file(s) can be found
#
override_files_dir: "{{ lookup('env', 'HOME') }}"
# Default directory where the backup tar file(s) can be found
# on the active controller
backup_dir: /opt/backups
#
# The platform backup tarball will be named in this format:
# <platform_backup_filename_prefix>_<timestamp>.tgz
#
platform_backup_filename_prefix: "{{ inventory_hostname }}_platform_backup"
#
# The stx-openstack application backup tarball will be named in this format:
# <openstack_backup_filename_prefix>_<timestamp>.tgz
#
openstack_backup_filename_prefix: "{{ inventory_hostname }}_openstack_backup"
#
# System backup tarball filename. User must provide the filename either
# in the override file or via -e option at the command line.
#
# This variable refers to the tarball that is generated by the backup
# procedure and used in the restore phase.
#
backup_filename:
#
# An indication whether it is a full restore or partial restore.
# True: a full restore where storage partition(s) is/are wiped during
# platform restore and ceph data needs restored
# False: a partial restore where ceph data remain intact during restore
#
# This variable is used for StarlingX OpenStack application restore only
#
restore_ceph_data: false
#
# Default directory where the system backup tarballs fetched from the
# active controller can be found
#
host_backup_dir: "{{ lookup('env', 'HOME') }}"

View File

@ -0,0 +1,29 @@
---
#
# Copyright (c) 2019 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
- hosts: all
# If gathering facts is really necessary, run setup task AFTER host connectivity
# check block in prepare-env role.
gather_facts: no
vars_files:
- host_vars/default.yml
# Main play
roles:
- include-override-files
- bootstrap/prepare-env
- { role: bootstrap/validate-config, when: not skip_play, become: yes }
- { role: bootstrap/store-passwd, when: not skip_play and save_password, become: yes }
- { role: bootstrap/apply-bootstrap-manifest, when: not skip_play and not replayed, become: yes }
- { role: bootstrap/persist-config, when: not skip_play, become: yes }
- { role: bootstrap/bringup-essential-services, when: not skip_play, become: yes }
vars:
change_password: false
skip_play: false
replayed: false
mode: 'bootstrap'

View File

@ -1,29 +0,0 @@
---
#
# Copyright (c) 2019 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
- hosts: all
# If gathering facts is really necessary, run setup task AFTER host connectivity
# check block in prepare-env role.
gather_facts: no
vars_files:
- host_vars/default.yml
# Main play
roles:
- include-override-files
- prepare-env
- { role: validate-config, when: not skip_play, become: yes }
- { role: store-passwd, when: not skip_play and save_password, become: yes }
- { role: apply-bootstrap-manifest, when: not skip_play and not replayed, become: yes }
- { role: persist-config, when: not skip_play, become: yes }
- { role: bringup-essential-services, when: not skip_play, become: yes }
vars:
change_password: false
skip_play: false
replayed: false
mode: 'bootstrap'

View File

@ -229,14 +229,46 @@ password_change_responses:
#
override_files_dir: "{{ lookup('env', 'HOME') }}"
# BACKUP AND RESTORE
# ==================
#
# Location where the platform backup tar file is placed to restore the platform.
# Location where the backup tar file is placed to perform the restore.
# This location must be specified at the command line via ansible-playbook -e option.
initial_backup_dir:
# Platform backup tar file. The filename must be specified at the command line via
# ansible-playbook -e option.
# This variable refers to the tar file that is generated by the backup
# procedure and used in the restore phase. The filename must be specified
# at the command line via ansible-playbook -e option.
backup_filename:
# Default directory where the backup tar file(s) can be found
# on the active controller
backup_dir: /opt/backups
# The platform backup tarball will be named in this format:
# <platform_backup_filename_prefix>_<timestamp>.tgz
#
platform_backup_filename_prefix: "{{ inventory_hostname }}_platform_backup"
# The stx-openstack application backup tarball will be named in this format:
# <openstack_backup_filename_prefix>_<timestamp>.tgz
#
openstack_backup_filename_prefix: "{{ inventory_hostname }}_openstack_backup"
# An indication whether it is a full restore or partial restore.
# true: a full restore where storage partition(s) is/are wiped during
# platform restore and ceph data needs restored
# false: a partial restore where ceph data remain intact during restore
#
# This variable is used for StarlingX OpenStack application restore only
#
restore_ceph_data: false
# Default directory where the system backup tarballs fetched from the
# active controller can be found
#
host_backup_dir: "{{ lookup('env', 'HOME') }}"
# Flag file to indicate if platform restore is in progress
#
restore_in_progress_flag: /etc/platform/.restore_in_progress

View File

@ -12,7 +12,7 @@
roles:
- include-override-files
- pre-restore-bootstrap
- restore-platform/pre-restore-bootstrap
vars:
change_password: false
@ -28,4 +28,4 @@
roles:
- include-override-files
- { role: restore-more-data, become: yes }
- { role: restore-platform/restore-more-data, become: yes }

View File

@ -453,14 +453,18 @@
Backup tar file(s) are now available in {{ backup_dir }} on the active controller.
- block:
- name: Transfer backup tar files to the local machine
- name: Transfer platform backup tar file to the local machine
fetch:
src: "{{ item }}"
src: "{{ platform_backup_file_path }}"
dest: "{{ host_backup_dir }}/"
flat: yes
with_items:
- "{{ platform_backup_file_path }}"
- "{{ openstack_backup_file_path }}"
- name: Transfer openstack backup tar files to the local machine if it exists
fetch:
src: "{{ openstack_backup_file_path}}"
dest: "{{ host_backup_dir }}/"
flat: yes
when: check_mariadb_pod.rc == 0 or check_openstack_uploaded.rc == 0
- name: Notify the user where the backup tar file(s) can be found
debug: