Merge "BaR Always do MySQL dumps even the services wont be stopped"

This commit is contained in:
Zuul 2020-03-27 03:49:37 +00:00 committed by Gerrit Code Review
commit 92b0f84876
3 changed files with 46 additions and 7 deletions

View File

@ -68,18 +68,48 @@
- kbd
- puppet
- hiera
- python3-docker
- name: Create hiera config file
file:
path: "{{ ansible_user_dir }}/hiera.yaml"
state: touch
- name: pull an image
- name: Create hieradata directory
file:
path: "{{ ansible_user_dir }}/hieradata"
state: directory
mode: '0755'
- name: Insert some data into hiera.yaml
copy:
dest: "{{ ansible_user_dir }}/hiera.yaml"
content: |
---
:backends:
- json
:json:
:datadir: {{ ansible_user_dir }}/hieradata
:hierarchy:
- service_configs
- name: Insert some data into service_configs.json
copy:
dest: "{{ ansible_user_dir }}/hieradata/service_configs.json"
content: |
{
"mysql::server::root_password": "password"
}
- name: pull some images
docker_image:
name: centos:8
name: "{{ item }}"
source: pull
vars:
ansible_python_interpreter: "{{ ansible_user_dir }}/test-python/bin/python"
with_items:
- centos:8
- mysql
- name: Create a data container
docker_container:
@ -92,3 +122,11 @@
- docker-container2
vars:
ansible_python_interpreter: "{{ ansible_user_dir }}/test-python/bin/python"
- name: Start myql container
docker_container:
name: mysql
image: mysql
detach: true
env:
MYSQL_ROOT_PASSWORD: password

View File

@ -17,7 +17,7 @@
# Create a backup for each database into seperate files.
- name: Get database root password
command: |
hiera -c /etc/puppet/hiera.yaml mysql::server::root_password
hiera -c '{{ tripleo_backup_and_restore_hiera_config_file }}' 'mysql::server::root_password'
when: mysql_password is undefined
register: mysql_password
become: true
@ -26,7 +26,7 @@
- name: Get galera bind_address
command: |
hiera -c /etc/puppet/hiera.yaml 'tripleo::profile::pacemaker::database::mysql::bind_address'
hiera -c '{{ tripleo_backup_and_restore_hiera_config_file }}' 'tripleo::profile::pacemaker::database::mysql::bind_address'
when: tripleo_backup_and_restore_pacemaker_galera_bind_address is undefined
register: tripleo_backup_and_restore_pacemaker_galera_bind_address
become: true
@ -94,12 +94,15 @@
- mysql_password.stderr is defined
- tripleo_backup_and_restore_mysql_container == "mysql"
- not enabled_galera
- tripleo_backup_and_restore_service_manager|bool
tags:
- bar_create_recover_image
- name: Stop pacemaker
command: pcs cluster stop --all
when: enabled_galera
when:
- enabled_galera
- tripleo_backup_and_restore_service_manager|bool
run_once: true
tags:
- bar_create_recover_image

View File

@ -45,8 +45,6 @@
- name: Backup the database
import_tasks: db_backup.yml
when:
- tripleo_backup_and_restore_service_manager
- name: Create recovery images with ReaR
import_tasks: run_backup.yml