Merge "After SFTP backup, the backup file and the iso must be deleted from the machine"
This commit is contained in:
commit
db4c40f387
@ -73,3 +73,14 @@
|
|||||||
- tripleo_backup_and_restore_enable_snapshots|bool
|
- tripleo_backup_and_restore_enable_snapshots|bool
|
||||||
tags:
|
tags:
|
||||||
- bar_create_recover_image
|
- bar_create_recover_image
|
||||||
|
|
||||||
|
- name: Clean old backups
|
||||||
|
shell: |
|
||||||
|
set -o pipefail
|
||||||
|
rm -rf /tmp/rear.* || true
|
||||||
|
rm -rf /var/lib/rear/output/*
|
||||||
|
failed_when: false
|
||||||
|
args:
|
||||||
|
warn: false
|
||||||
|
tags:
|
||||||
|
- bar_create_recover_image
|
||||||
|
@ -115,3 +115,36 @@
|
|||||||
backup: true
|
backup: true
|
||||||
tags:
|
tags:
|
||||||
- bar_setup_rear
|
- bar_setup_rear
|
||||||
|
|
||||||
|
- name: Load rear config
|
||||||
|
become: true
|
||||||
|
slurp:
|
||||||
|
src: /etc/rear/local.conf
|
||||||
|
register: rear_config
|
||||||
|
tags:
|
||||||
|
- bar_setup_rear
|
||||||
|
|
||||||
|
- name: Extract OUTPUT_URL from rear config
|
||||||
|
set_fact:
|
||||||
|
output_url: "{{ rear_config.content | b64decode | regex_findall('OUTPUT_URL=(.+)') | first }}"
|
||||||
|
tags:
|
||||||
|
- bar_setup_rear
|
||||||
|
|
||||||
|
- name: Check if this is a SFTP backup
|
||||||
|
set_fact:
|
||||||
|
sftp_backup: "{{ output_url is search ('sftp://') }}"
|
||||||
|
tags:
|
||||||
|
- bar_setup_rear
|
||||||
|
|
||||||
|
- name: Extract the SFTP hostname
|
||||||
|
set_fact:
|
||||||
|
sftp_host: "{{ output_url | regex_search('(?<=@)(.*?)(?=/)') }}"
|
||||||
|
when: sftp_backup
|
||||||
|
tags:
|
||||||
|
- bar_setup_rear
|
||||||
|
|
||||||
|
- name: Retrieve host ssh fingerprint
|
||||||
|
shell: "ssh-keyscan -H {{ sftp_host }} >> ~/.ssh/known_hosts"
|
||||||
|
when: sftp_backup
|
||||||
|
tags:
|
||||||
|
- bar_setup_rear
|
||||||
|
Loading…
Reference in New Issue
Block a user