tripleo-ansible/tripleo_ansible/playbooks/ceph-backup.yaml

108 lines
3.8 KiB
YAML

---
# Copyright 2019 Red Hat, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
- name: Ceph MON
become: true
hosts: overcloud_ceph_mon
tasks:
- name: Stop monitor services
import_role:
name: backup_and_restore
tasks_from: ceph_mon_stop
tags: backup
- name: Ceph MGR
become: true
hosts: overcloud_ceph_mgr
tasks:
- name: Stop manager services
import_role:
name: backup_and_restore
tasks_from: ceph_mgr_stop
tags: backup
- name: Ceph NFS
become: true
hosts: overcloud_ceph_nfs
tasks:
- name: Stop ceph_nfs services
import_role:
name: backup_and_restore
tasks_from: ceph_nfs_stop
tags: backup
- name: Ceph MDS
hosts: undercloud
tasks:
- name: Set variables
set_fact:
ceph_ansible_path: "{{ ceph_ansible_path_dir is defined | ternary ( ceph_ansible_path_dir, '/usr/share/ceph-ansible' ) }}"
ansible_log: "{{ ceph_deactivate_log is defined | ternary ( ceph_deactivate_log, '/home/stack/ceph_deactivate_mds.log' ) }}"
ceph_ansible_inventory: |
"{{ ansible_inventory is defined | ternary (ansible_inventory, '/home/stack/config-download/overcloud/ceph-ansible/inventory.yml' ) }}"
ceph_deactivate_mds_file_path: |
"{{ ceph_deactivate_mds_file is defined | ternary (ceph_deactivate_mds_file, '/usr/share/ansible/tripleo_playbooks/ceph_deactivate_mds.yaml') }}"
ceph_extra_vars_file_path: |
"{{ ceph_extra_vars_file is defined | ternary (ceph_extra_vars_file, '@/home/stack/config-download/overcloud/ceph-ansible/extra_vars.yml') }}"
when:
- groups["overcloud_ceph_mds"] is defined
- groups["overcloud_ceph_mds"]|length>0
- name: Execute the deactivate_mds ansible playbook
shell: |
set -o pipefail
ANSIBLE_ACTION_PLUGINS={{ ceph_ansible_path }}/plugins/actions/ \
ANSIBLE_CALLBACK_PLUGINS={{ ceph_ansible_path }}/plugins/callback/ \
ANSIBLE_FILTER_PLUGINS={{ ceph_ansible_path }}/plugins/filter/ \
ANSIBLE_ROLES_PATH={{ ceph_ansible_path }}/roles/ \
ANSIBLE_LIBRARY={{ ceph_ansible_path }}/library/ \
ANSIBLE_CONFIG={{ ceph_ansible_path }}/ansible.cfg \
ANSIBLE_REMOTE_TEMP=/tmp/ceph_ansible_tmp \
ANSIBLE_FORKS=25 \
ANSIBLE_GATHER_TIMEOUT=60 \
ANSIBLE_CALLBACK_WHITELIST=profile_tasks \
ANSIBLE_STDOUT_CALLBACK=default \
ANSIBLE_LOG_PATH={{ ansible_log }} \
ansible-playbook --skip-tags package-install,with_pkg \
-e ansible_python_interpreter=/usr/libexec/platform-python \
--extra-vars {{ ceph_extra_vars_file_path }} \
-i {{ ceph_ansible_inventory }} \
{{ ceph_deactivate_mds_file_path }}
tags: backup
when:
- groups["overcloud_ceph_mds"] is defined
- groups["overcloud_ceph_mds"]|length>0
- name: Ceph RGW
become: true
hosts: overcloud_ceph_rgw
tasks:
- name: Stop ceph_rgw services
import_role:
name: backup_and_restore
tasks_from: ceph_rgw_stop
tags: backup
- name: Backup Ceph directory
become: true
hosts: overcloud_ceph_mon
tasks:
- name: Backup ceph directory and storage on the shared directory
import_role:
name: backup_and_restore
tasks_from: ceph_backup
tags: backup