dell / ansible-vxrail

Apache License 2.0
23 stars 9 forks source link

VxRail Backup Role #22

Open Klaas- opened 8 months ago

Klaas- commented 8 months ago

Hi, is there interest in addin a backup role to this collection? I was unsatisfied with the backup procedure so I automated it with ansible.

If you guys are interested in merging I would create a PR for a whole role, if not I just leave the essentials here for the next person that wants to automate the vxrail backup :)

- name: Start VxRail Backup
  ansible.builtin.uri:
    url: https://{{ vxrail_server }}/rest/vxm/private/v1/cluster/backup
    user: "{{ vsphere_administrator_username }}"
    password: "{{ vsphere_administrator_password }}"
    method: post
    force_basic_auth: true
    body_format: json
    status_code: 201
    body:
      location_type: "{{ vxrail_backup_location_type }}"
      location: "{{ vxrail_backup_location_server }}/{{ vxrail_backup_location_path }}"
      location_user: "{{ vxrail_backup_location_user }}"
      location_password: "{{ vxrail_backup_location_password }}"
      backup_password: "{{ vxrail_backup_password }}"
      vc_username: "{{ vsphere_administrator_username }}"
      vc_password: "{{ vsphere_administrator_password }}"
  register: vxrail_backup_invocation

- name: Check VxRail Backup status and wait for it to finish
  ansible.builtin.uri:
    url: https://{{ vxrail_server }}/rest/vxm/v1/requests/{{ vxrail_backup_invocation.json.request_id }}
    user: "{{ vsphere_administrator_username }}"
    password: "{{ vsphere_administrator_password }}"
    force_basic_auth: true
  register: vxrail_backup_job_check
  # Wait for finish
  until: vxrail_backup_job_check.json.state is defined and vxrail_backup_job_check.json.state == "COMPLETED"
  retries: 20
  delay: 60
Klaas- commented 5 months ago

any interest in adding such a role @vxrail-ansible-team @CraigOLeary @rzfeeser ?

CraigOLeary commented 5 months ago

Hi @Klaas- , can you please open a pull request with your contribution where it can be reviewed by the team.

Thanks.