48 lines
1.8 KiB
YAML
48 lines
1.8 KiB
YAML
---
|
|
#
|
|
# Copyright (c) 2019 Wind River Systems, Inc.
|
|
#
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
#
|
|
# SUB-TASKS DESCRIPTION:
|
|
# For remote play transfer the backup tar file to controller-0
|
|
|
|
- block:
|
|
# Check if the backup tarball already exists. If it is the second run
|
|
# after the reboot, no need to transfer the backup tarball again.
|
|
- name: Check if {{ backup_filename }} has been uploaded already
|
|
stat:
|
|
path: "{{ target_backup_dir }}/{{ backup_filename }}"
|
|
register: check_backup_tarball
|
|
|
|
- block:
|
|
# TODO(wzhou): Considering to break backup tarball into multiple small tarfiles
|
|
# During restore upload each small tarfile one at a time to restore a subfunction.
|
|
|
|
# Because Ansible copy module uses ansible_remote_tmp directory as
|
|
# a staging area to transfer file, the default ansible_remote_tmp
|
|
# which is set in /tmp (1GB) may be too small for backup tarball,
|
|
# we require user to set ansible_remote_tmp to a new directory in
|
|
# /home/sysadmin via -e option on the command line. For example:
|
|
# -e "ansible_remote_tmp=/home/sysadmin/ansible-restore"
|
|
- name: Transfer backup tarball to {{ target_backup_dir }} on controller-0
|
|
copy:
|
|
src: "{{ initial_backup_dir }}/{{ backup_filename }}"
|
|
dest: "{{ target_backup_dir }}"
|
|
owner: root
|
|
group: root
|
|
mode: 0644
|
|
|
|
# As an alternative to Ansible copy, synchronize module may be
|
|
# used to transfer large files. But synchronize is broken in Ansible 2.8
|
|
# https://github.com/ansible/ansible/issues/56629.
|
|
# - name: Transfer backup tarball to /scratch on controller-0
|
|
# synchronize:
|
|
# src: "{{ initial_backup_dir }}/{{ backup_filename }}"
|
|
# dest: "{{ target_backup_dir }}/{{ backup_filename }}"
|
|
|
|
when: not check_backup_tarball.stat.exists
|
|
when: inventory_hostname != "localhost"
|
|
become: yes
|
|
become_user: root
|