Merge "Modifying playbooks to support python-tripleoclient B&R commands" into stable/train
This commit is contained in:
commit
fec37d2710
|
@ -0,0 +1,31 @@
|
||||||
|
---
|
||||||
|
# Copyright 2020 Red Hat, Inc.
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
- become: true
|
||||||
|
hosts: ceph_mon
|
||||||
|
name: Backup ceph authentication
|
||||||
|
tasks:
|
||||||
|
- name: Backup ceph authentication role
|
||||||
|
include_role:
|
||||||
|
name: backup-and-restore
|
||||||
|
tasks_from: ceph_authentication
|
||||||
|
tags:
|
||||||
|
- bar_create_recover_image
|
||||||
|
|
||||||
|
- name: TripleO Controller backup.
|
||||||
|
hosts: Controller
|
||||||
|
remote_user: "{{ tripleo_target_user | default(lookup('env', 'USER')) }}"
|
||||||
|
become: true
|
||||||
|
roles:
|
||||||
|
- role: backup-and-restore
|
|
@ -14,12 +14,14 @@
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
- name: TripleO Undercloud backup workflows
|
- name: TripleO Undercloud backup workflows
|
||||||
hosts: undercloud
|
connection: "{{ (tripleo_target_host is defined) | ternary('ssh', 'local') }}"
|
||||||
gather_facts: false
|
hosts: "{{ tripleo_target_host | default('localhost') }}"
|
||||||
|
remote_user: "{{ tripleo_target_user | default(lookup('env', 'USER')) }}"
|
||||||
|
gather_facts: "{{ (tripleo_target_host is defined) | ternary(true, false) }}"
|
||||||
any_errors_fatal: true
|
any_errors_fatal: true
|
||||||
max_fail_percentage: 0
|
|
||||||
vars:
|
vars:
|
||||||
sources_path: '/home/stack/'
|
sources_path: "{{ lookup('env', 'HOME') }}"
|
||||||
|
hide_sensitive_logs: true
|
||||||
handlers:
|
handlers:
|
||||||
# Perform some cleanup
|
# Perform some cleanup
|
||||||
- name: cleanup the backup
|
- name: cleanup the backup
|
||||||
|
@ -32,6 +34,14 @@
|
||||||
- "{{ tmpdir.path }}/"
|
- "{{ tmpdir.path }}/"
|
||||||
|
|
||||||
pre_tasks:
|
pre_tasks:
|
||||||
|
- name: Set local connection user facts
|
||||||
|
set_fact:
|
||||||
|
ansible_home: "{{ lookup('env', 'HOME') }}"
|
||||||
|
ansible_user: "{{ lookup('env', 'USER') }}"
|
||||||
|
run_once: true
|
||||||
|
when:
|
||||||
|
- (tripleo_target_host is defined) | ternary('ssh', 'local') == 'local'
|
||||||
|
|
||||||
# Action to know if there is enough available space
|
# Action to know if there is enough available space
|
||||||
# to run the Undercloud backup
|
# to run the Undercloud backup
|
||||||
- name: Get free space
|
- name: Get free space
|
||||||
|
@ -65,15 +75,23 @@
|
||||||
notify:
|
notify:
|
||||||
- cleanup the backup
|
- cleanup the backup
|
||||||
|
|
||||||
# The Undercloud database password for the root
|
- name: Mysql root password block
|
||||||
# user is stored in a Mistral environment, we
|
block:
|
||||||
# need the password in order to run the database dump
|
- name: Read tripleo password file
|
||||||
- name: get_database_credentials
|
slurp:
|
||||||
shell: |-
|
src: "{{ ansible_home }}/tripleo-undercloud-passwords.yaml"
|
||||||
set -o pipefail
|
register: tripleo_undercloud_passwords
|
||||||
mistral environment-get tripleo.undercloud-config -f json | jq -r ".Variables" | jq -r ".undercloud_db_password"
|
no_log: "{{ hide_sensitive_logs | bool }}"
|
||||||
register: undercloud_db_password
|
|
||||||
no_log: "{{ not ((ansible_verbosity | int) >= 2) | bool }}"
|
- name: Set mysql root password
|
||||||
|
set_fact:
|
||||||
|
MysqlRootPassword: "{{ (tripleo_undercloud_passwords['content'] | b64decode | from_yaml)['parameter_defaults']['MysqlRootPassword'] }}"
|
||||||
|
no_log: "{{ hide_sensitive_logs | bool }}"
|
||||||
|
rescue:
|
||||||
|
- name: Set mysql root password (fallback)
|
||||||
|
set_fact:
|
||||||
|
MysqlRootPassword: "{{ lookup('ini', 'undercloud_mysql_root_password section=auth file=' ~ ansible_home ~ '/undercloud-passwords.conf') }}"
|
||||||
|
no_log: "{{ hide_sensitive_logs | bool }}"
|
||||||
|
|
||||||
- name: Create the names for the temporary backup files
|
- name: Create the names for the temporary backup files
|
||||||
set_fact:
|
set_fact:
|
||||||
|
@ -87,13 +105,18 @@
|
||||||
become: true
|
become: true
|
||||||
shell: |-
|
shell: |-
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
podman exec -i mysql mysqldump -u root -p{{ undercloud_db_password.stdout }} --opt --all-databases | gzip > {{ db_path }}
|
podman exec -i mysql mysqldump \
|
||||||
|
-u root \
|
||||||
|
-p{{ MysqlRootPassword }} \
|
||||||
|
--opt \
|
||||||
|
--all-databases | gzip > {{ db_path }}
|
||||||
|
no_log: "{{ hide_sensitive_logs | bool }}"
|
||||||
|
|
||||||
- name: Backup the filesystem
|
- name: Backup the filesystem
|
||||||
become: true
|
become: true
|
||||||
shell: |
|
shell: |
|
||||||
tar --xattrs --ignore-failed-read -C / -cf {{ fs_path }} {{ sources_path }}
|
tar --xattrs --ignore-failed-read -C / -cf {{ fs_path }} {{ sources_path }}
|
||||||
chown stack. {{ fs_path }}
|
chown {{ lookup('env', 'USER') }} {{ fs_path }}
|
||||||
|
|
||||||
- name: compress all the files in tar.gz
|
- name: compress all the files in tar.gz
|
||||||
archive:
|
archive:
|
|
@ -0,0 +1,21 @@
|
||||||
|
---
|
||||||
|
# Copyright 2019 Red Hat, Inc.
|
||||||
|
#
|
||||||
|
# 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: TripleO Undercloud backup.
|
||||||
|
hosts: Undercloud
|
||||||
|
remote_user: "{{ tripleo_target_user | default(lookup('env', 'USER')) }}"
|
||||||
|
become: true
|
||||||
|
roles:
|
||||||
|
- role: backup-and-restore
|
|
@ -0,0 +1,21 @@
|
||||||
|
---
|
||||||
|
# Copyright 2020 Red Hat, Inc.
|
||||||
|
#
|
||||||
|
# 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: TripleO BackupNode NFS installation and configuration.
|
||||||
|
hosts: BackupNode
|
||||||
|
remote_user: "{{ tripleo_target_user | default(lookup('env', 'USER')) }}"
|
||||||
|
become: true
|
||||||
|
roles:
|
||||||
|
- role: backup-and-restore
|
|
@ -0,0 +1,21 @@
|
||||||
|
---
|
||||||
|
# Copyright 2020 Red Hat, Inc.
|
||||||
|
#
|
||||||
|
# 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: TripleO Controller ReaR installation and configuration.
|
||||||
|
hosts: Controller
|
||||||
|
remote_user: "{{ tripleo_target_user | default(lookup('env', 'USER')) }}"
|
||||||
|
become: true
|
||||||
|
roles:
|
||||||
|
- role: backup-and-restore
|
|
@ -0,0 +1,21 @@
|
||||||
|
---
|
||||||
|
# Copyright 2020 Red Hat, Inc.
|
||||||
|
#
|
||||||
|
# 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: TripleO Undercloud ReaR installation and configuration.
|
||||||
|
hosts: Undercloud
|
||||||
|
remote_user: "{{ tripleo_target_user | default(lookup('env', 'USER')) }}"
|
||||||
|
become: true
|
||||||
|
roles:
|
||||||
|
- role: backup-and-restore
|
Loading…
Reference in New Issue