Remove all the extra folders in the backup and restore role
This review cleans up the extra folders for when we move this to a collection. Change-Id: Ica06a34de3e153c665cadb01fdeb6b6a7dededc2
This commit is contained in:
parent
be80cd7ac6
commit
644df915a9
|
@ -1,106 +0,0 @@
|
|||
---
|
||||
# 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.
|
||||
|
||||
|
||||
# "backup_and_restore" will search for and load any operating system variable file
|
||||
|
||||
# found within the "vars/" path. If no OS files are found the task will skip.
|
||||
- name: Gather variables for each operating system
|
||||
include_vars: "{{ item }}"
|
||||
with_first_found:
|
||||
- skip: true
|
||||
files:
|
||||
- "{{ ansible_distribution | lower }}-{{ ansible_distribution_version | lower }}.yml"
|
||||
- "{{ ansible_distribution | lower }}-{{ ansible_distribution_major_version | lower }}.yml"
|
||||
- "{{ ansible_os_family | lower }}-{{ ansible_distribution_major_version | lower }}.yml"
|
||||
- "{{ ansible_distribution | lower }}.yml"
|
||||
- "{{ ansible_os_family | lower }}-{{ ansible_distribution_version.split('.')[0] }}.yml"
|
||||
- "{{ ansible_os_family | lower }}.yml"
|
||||
tags:
|
||||
- always
|
||||
|
||||
- name: Install required packages for the NFS server
|
||||
become: true
|
||||
package:
|
||||
name: "{{ tripleo_backup_and_restore_nfs_packages }}"
|
||||
state: present
|
||||
tags:
|
||||
- bar_setup_nfs_server
|
||||
|
||||
- name: Allow NFS connections port 111.
|
||||
become: true
|
||||
iptables:
|
||||
action: insert
|
||||
rule_num: '1'
|
||||
chain: INPUT
|
||||
ctstate: NEW
|
||||
protocol: tcp
|
||||
destination_port: '111'
|
||||
jump: ACCEPT
|
||||
comment: Accept new NFS connections (111).
|
||||
tags:
|
||||
- bar_setup_nfs_server
|
||||
|
||||
- name: Allow NFS connections port 2049.
|
||||
become: true
|
||||
iptables:
|
||||
action: insert
|
||||
rule_num: '1'
|
||||
chain: INPUT
|
||||
ctstate: NEW
|
||||
protocol: tcp
|
||||
destination_port: '2049'
|
||||
jump: ACCEPT
|
||||
comment: Accept new NFS connections (2049).
|
||||
tags:
|
||||
- bar_setup_nfs_server
|
||||
|
||||
- name: Enable the NFS service in the NFS server
|
||||
become: true
|
||||
systemd:
|
||||
name: nfs-server
|
||||
enabled: true
|
||||
tags:
|
||||
- bar_setup_nfs_server
|
||||
|
||||
- name: Create backup folder in the NFS server
|
||||
become: true
|
||||
file:
|
||||
path: "{{ tripleo_backup_and_restore_nfs_storage_folder }}"
|
||||
state: directory
|
||||
mode: '0777'
|
||||
tags:
|
||||
- bar_setup_nfs_server
|
||||
|
||||
- name: Generate NFS exports table in the server
|
||||
become: true
|
||||
template:
|
||||
src: exports.j2
|
||||
dest: /etc/exports
|
||||
owner: root
|
||||
group: root
|
||||
mode: '0644'
|
||||
backup: true
|
||||
tags:
|
||||
- bar_setup_nfs_server
|
||||
|
||||
- name: Reload the NFS service
|
||||
become: true
|
||||
systemd:
|
||||
name: nfs-server
|
||||
state: reloaded
|
||||
tags:
|
||||
- bar_setup_nfs_server
|
|
@ -1,103 +0,0 @@
|
|||
---
|
||||
# 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.
|
||||
|
||||
|
||||
# "backup_and_restore" will search for and load any operating system variable file
|
||||
|
||||
# found within the "vars/" path. If no OS files are found the task will skip.
|
||||
- name: Gather variables for each operating system
|
||||
include_vars: "{{ item }}"
|
||||
with_first_found:
|
||||
- skip: true
|
||||
files:
|
||||
- "{{ ansible_distribution | lower }}-{{ ansible_distribution_version | lower }}.yml"
|
||||
- "{{ ansible_distribution | lower }}-{{ ansible_distribution_major_version | lower }}.yml"
|
||||
- "{{ ansible_os_family | lower }}-{{ ansible_distribution_major_version | lower }}.yml"
|
||||
- "{{ ansible_distribution | lower }}.yml"
|
||||
- "{{ ansible_os_family | lower }}-{{ ansible_distribution_version.split('.')[0] }}.yml"
|
||||
- "{{ ansible_os_family | lower }}.yml"
|
||||
tags:
|
||||
- always
|
||||
|
||||
- name: Install required packages for ReaR
|
||||
become: true
|
||||
package:
|
||||
name: "{{ tripleo_backup_and_restore_rear_packages }}"
|
||||
state: present
|
||||
tags:
|
||||
- bar_setup_rear
|
||||
|
||||
- name: Get local hostname
|
||||
command: hostname
|
||||
register: tripleo_backup_and_restore_hostname
|
||||
when: tripleo_backup_and_restore_hostname is undefined
|
||||
tags:
|
||||
- bar_setup_rear
|
||||
|
||||
- name: Set bootstrap nodeid
|
||||
become: true
|
||||
register: tripleo_backup_and_restore_bootstrap_nodeid
|
||||
command: |
|
||||
/bin/hiera -c {{ tripleo_backup_and_restore_hiera_config_file }} 'mysql_short_bootstrap_node_name'
|
||||
tags:
|
||||
- bar_setup_rear
|
||||
|
||||
- name: List enabled services by node
|
||||
become: true
|
||||
register: tripleo_backup_and_restore_enabled_services
|
||||
command: |
|
||||
/bin/hiera -c {{ tripleo_backup_and_restore_hiera_config_file }} 'service_names'
|
||||
tags:
|
||||
- bar_setup_rear
|
||||
|
||||
- name: Calculate exclude paths
|
||||
register: tripleo_backup_and_restore_exclude_paths
|
||||
set_fact:
|
||||
tripleo_backup_and_restore_exclude_paths:
|
||||
- "{{ tripleo_backup_and_restore_exclude_paths_common }}"
|
||||
- "{{ (tripleo_backup_and_restore_enabled_services.stdout is search('nova_compute')) |
|
||||
ternary(tripleo_backup_and_restore_exclude_paths_compute, []) }}"
|
||||
- "{{ (tripleo_backup_and_restore_bootstrap_nodeid.stdout != tripleo_backup_and_restore_hostname.stdout and
|
||||
tripleo_backup_and_restore_enabled_services.stdout is search('pacemaker') and
|
||||
tripleo_backup_and_restore_enabled_services.stdout is search('mysql') and
|
||||
tripleo_backup_and_restore_exclude_paths_controller_non_bootrapnode|bool) |
|
||||
ternary(tripleo_backup_and_restore_exclude_paths_controller, []) }}"
|
||||
tags:
|
||||
- bar_setup_rear
|
||||
|
||||
- name: Generate ReaR config file
|
||||
become: true
|
||||
template:
|
||||
src: local.conf.j2
|
||||
dest: /etc/rear/local.conf
|
||||
owner: root
|
||||
group: root
|
||||
mode: '0644'
|
||||
backup: true
|
||||
tags:
|
||||
- bar_setup_rear
|
||||
|
||||
- name: Generate ReaR rescue file
|
||||
become: true
|
||||
template:
|
||||
src: rescue.conf.j2
|
||||
dest: /etc/rear/rescue.conf
|
||||
owner: root
|
||||
group: root
|
||||
mode: '0644'
|
||||
backup: true
|
||||
tags:
|
||||
- bar_setup_rear
|
|
@ -33,25 +33,25 @@
|
|||
- always
|
||||
|
||||
- name: Setup NFS server
|
||||
import_tasks: ../setup_nfs/tasks/main.yml
|
||||
import_tasks: setup_nfs.yml
|
||||
|
||||
- name: Setup ReaR
|
||||
import_tasks: ../setup_rear/tasks/main.yml
|
||||
import_tasks: setup_rear.yml
|
||||
|
||||
- name: Service management
|
||||
import_tasks: ../backup/tasks/service_manager_pause.yml
|
||||
import_tasks: service_manager_pause.yml
|
||||
when:
|
||||
- tripleo_backup_and_restore_service_manager
|
||||
|
||||
- name: Backup the database
|
||||
import_tasks: ../backup/tasks/db_backup.yml
|
||||
import_tasks: db_backup.yml
|
||||
when:
|
||||
- tripleo_backup_and_restore_service_manager
|
||||
|
||||
- name: Create recovery images with ReaR
|
||||
import_tasks: ../backup/tasks/main.yml
|
||||
import_tasks: run_backup.yml
|
||||
|
||||
- name: Service management
|
||||
import_tasks: ../backup/tasks/service_manager_unpause.yml
|
||||
import_tasks: service_manager_unpause.yml
|
||||
when:
|
||||
- tripleo_backup_and_restore_service_manager
|
||||
|
|
|
@ -32,5 +32,75 @@
|
|||
tags:
|
||||
- always
|
||||
|
||||
- name: Setup NFS
|
||||
import_tasks: ../setup_nfs/tasks/main.yml
|
||||
- name: Install required packages for the NFS server
|
||||
become: true
|
||||
package:
|
||||
name: "{{ tripleo_backup_and_restore_nfs_packages }}"
|
||||
state: present
|
||||
tags:
|
||||
- bar_setup_nfs_server
|
||||
|
||||
- name: Allow NFS connections port 111.
|
||||
become: true
|
||||
iptables:
|
||||
action: insert
|
||||
rule_num: '1'
|
||||
chain: INPUT
|
||||
ctstate: NEW
|
||||
protocol: tcp
|
||||
destination_port: '111'
|
||||
jump: ACCEPT
|
||||
comment: Accept new NFS connections (111).
|
||||
tags:
|
||||
- bar_setup_nfs_server
|
||||
|
||||
- name: Allow NFS connections port 2049.
|
||||
become: true
|
||||
iptables:
|
||||
action: insert
|
||||
rule_num: '1'
|
||||
chain: INPUT
|
||||
ctstate: NEW
|
||||
protocol: tcp
|
||||
destination_port: '2049'
|
||||
jump: ACCEPT
|
||||
comment: Accept new NFS connections (2049).
|
||||
tags:
|
||||
- bar_setup_nfs_server
|
||||
|
||||
- name: Enable the NFS service in the NFS server
|
||||
become: true
|
||||
systemd:
|
||||
name: nfs-server
|
||||
enabled: true
|
||||
tags:
|
||||
- bar_setup_nfs_server
|
||||
|
||||
- name: Create backup folder in the NFS server
|
||||
become: true
|
||||
file:
|
||||
path: "{{ tripleo_backup_and_restore_nfs_storage_folder }}"
|
||||
state: directory
|
||||
mode: '0777'
|
||||
tags:
|
||||
- bar_setup_nfs_server
|
||||
|
||||
- name: Generate NFS exports table in the server
|
||||
become: true
|
||||
template:
|
||||
src: exports.j2
|
||||
dest: /etc/exports
|
||||
owner: root
|
||||
group: root
|
||||
mode: '0644'
|
||||
backup: true
|
||||
tags:
|
||||
- bar_setup_nfs_server
|
||||
|
||||
- name: Reload the NFS service
|
||||
become: true
|
||||
systemd:
|
||||
name: nfs-server
|
||||
state: reloaded
|
||||
tags:
|
||||
- bar_setup_nfs_server
|
||||
|
|
|
@ -32,5 +32,72 @@
|
|||
tags:
|
||||
- always
|
||||
|
||||
- name: Setup ReaR
|
||||
import_tasks: ../setup_rear/tasks/main.yml
|
||||
- name: Install required packages for ReaR
|
||||
become: true
|
||||
package:
|
||||
name: "{{ tripleo_backup_and_restore_rear_packages }}"
|
||||
state: present
|
||||
tags:
|
||||
- bar_setup_rear
|
||||
|
||||
- name: Get local hostname
|
||||
command: hostname
|
||||
register: tripleo_backup_and_restore_hostname
|
||||
when: tripleo_backup_and_restore_hostname is undefined
|
||||
tags:
|
||||
- bar_setup_rear
|
||||
|
||||
- name: Set bootstrap nodeid
|
||||
become: true
|
||||
register: tripleo_backup_and_restore_bootstrap_nodeid
|
||||
command: |
|
||||
/bin/hiera -c {{ tripleo_backup_and_restore_hiera_config_file }} 'mysql_short_bootstrap_node_name'
|
||||
tags:
|
||||
- bar_setup_rear
|
||||
|
||||
- name: List enabled services by node
|
||||
become: true
|
||||
register: tripleo_backup_and_restore_enabled_services
|
||||
command: |
|
||||
/bin/hiera -c {{ tripleo_backup_and_restore_hiera_config_file }} 'service_names'
|
||||
tags:
|
||||
- bar_setup_rear
|
||||
|
||||
- name: Calculate exclude paths
|
||||
register: tripleo_backup_and_restore_exclude_paths
|
||||
set_fact:
|
||||
tripleo_backup_and_restore_exclude_paths:
|
||||
- "{{ tripleo_backup_and_restore_exclude_paths_common }}"
|
||||
- "{{ (tripleo_backup_and_restore_enabled_services.stdout is search('nova_compute')) |
|
||||
ternary(tripleo_backup_and_restore_exclude_paths_compute, []) }}"
|
||||
- "{{ (tripleo_backup_and_restore_bootstrap_nodeid.stdout != tripleo_backup_and_restore_hostname.stdout and
|
||||
tripleo_backup_and_restore_enabled_services.stdout is search('pacemaker') and
|
||||
tripleo_backup_and_restore_enabled_services.stdout is search('mysql') and
|
||||
tripleo_backup_and_restore_exclude_paths_controller_non_bootrapnode|bool) |
|
||||
ternary(tripleo_backup_and_restore_exclude_paths_controller, []) }}"
|
||||
tags:
|
||||
- bar_setup_rear
|
||||
|
||||
- name: Generate ReaR config file
|
||||
become: true
|
||||
template:
|
||||
src: local.conf.j2
|
||||
dest: /etc/rear/local.conf
|
||||
owner: root
|
||||
group: root
|
||||
mode: '0644'
|
||||
backup: true
|
||||
tags:
|
||||
- bar_setup_rear
|
||||
|
||||
- name: Generate ReaR rescue file
|
||||
become: true
|
||||
template:
|
||||
src: rescue.conf.j2
|
||||
dest: /etc/rear/rescue.conf
|
||||
owner: root
|
||||
group: root
|
||||
mode: '0644'
|
||||
backup: true
|
||||
tags:
|
||||
- bar_setup_rear
|
||||
|
|
Loading…
Reference in New Issue