Files
tripleo-operator-ansible/roles/tripleo_overcloud_backup/tasks/main.yml
Juan Pablo Lopez f90c7a44b6 Create tripleo_overcloud_backup role
- tripleo_overcloud_backup role was added to match python-tripleoclient
  interface for B&R overcloud command. It follows the same structure
  as tripleo_undercloud_backup role.
- 'tripleo_overcloud_backup_init' string variable was added for
  the flag '--init' for installing and configure 'rear' and 'nfs'.
  Depending on the value. WARNING: this flag will be deprecated
  in favor of '--setup-nfs' and '--setup-rear'.
- 'tripleo_overcloud_backup_setup_nfs' boolean variable was added
  for the flag '--setup-nfs' which will install and configure NFS
  server. Default to: false.
- 'tripleo_overcloud_backup_setup_rear' boolean variable was added
  for the flag '--setup-rear' which will install and configure ReaR
  on the overcloud controllers. Default to: false.
- 'tripleo_overcloud_backup_storage_ip' string variable was added
  for the flag '--storage-ip' which will allows to specify an ip for
  NFS / Backup server. It has precedence over '--extra-vars'. WARNING:
  this flag will be deprecated in favor of '--extra-vars'.
- 'tripleo_overcloud_backup_extra_vars' string variable was added
  for '--extra-vars' variable for passing variables as JSON string
  or JSON / YAML path.
- zuul.d updated to include molecule tests

Depends on: https://review.opendev.org/c/openstack/python-tripleoclient/+/771589

Change-Id: I0bdb9ce1e434f7ffd75d1931a70a451cdc48bc90
2021-02-09 10:27:01 +00:00

51 lines
1.9 KiB
YAML

---
- name: Setup overcloud backup facts
set_fact:
_backup_cmd: >-
{{ openstack_bin }} overcloud backup
{{ tripleo_overcloud_backup_init | tripleo.operator.shell_arg_list(parameter='--init') }}
{{ tripleo_overcloud_backup_setup_nfs | ternary('--setup-nfs', '') }}
{{ tripleo_overcloud_backup_setup_rear | ternary('--setup-rear', '') }}
{{ tripleo_overcloud_backup_storage_ip | tripleo.operator.shell_arg_list(parameter='--storage-ip') }}
{{ tripleo_overcloud_backup_extra_vars | tripleo.operator.shell_arg_list(parameter='--extra-vars') }}
{{ tripleo_overcloud_backup_log_output | ternary((">" ~ tripleo_overcloud_backup_log), '') }}
{{ tripleo_overcloud_backup_log_combine | ternary("2>&1", '') }}
_backup_env: {}
- name: Preserve existing log file if exists
timestamp_file:
path: "{{ tripleo_overcloud_backup_log }}"
when: tripleo_overcloud_backup_log_output|bool
- name: Show debug information
when: tripleo_overcloud_backup_debug|bool
block:
- name: Show the overcloud backup command
debug:
var: _backup_cmd
- name: Show the overcloud backup environment
debug:
var: _backup_env
- name: Write reproducer script
tripleo_shell_script:
dest: "{{ tripleo_overcloud_backup_home_dir }}/tripleo_overcloud_backup.sh"
shell_command: "{{ _backup_cmd }}"
shell_environment: "{{ _backup_env }}"
when: tripleo_overcloud_backup_generate_scripts|bool
- name: overcloud backup
shell: "{{ _backup_cmd }}" # noqa 305
environment: "{{ _backup_env }}"
args:
chdir: "{{ tripleo_overcloud_backup_home_dir }}"
warn: false
async: "{{ tripleo_overcloud_backup_timeout }}"
poll: "{{ tripleo_overcloud_backup_poll }}"
register: tripleo_overcloud_backup_result
changed_when: true
when:
- not ansible_check_mode|bool
- not tripleo_overcloud_backup_generate_scripts_only|bool