upgrade_backup.yml 970 B

12345678910111213141516171819202122232425
  1. ---
  2. - name: Backup etcd
  3. hosts: oo_etcd_hosts_to_backup
  4. tasks:
  5. - import_role:
  6. name: etcd
  7. tasks_from: backup.yml
  8. vars:
  9. r_etcd_common_backup_tag: "{{ etcd_backup_tag }}"
  10. r_etcd_common_backup_sufix_name: "{{ lookup('pipe', 'date +%Y%m%d%H%M%S') }}"
  11. r_etcd_common_skip_command_shim: true
  12. - name: Gate on etcd backup
  13. hosts: localhost
  14. connection: local
  15. tasks:
  16. - set_fact:
  17. etcd_backup_completed: "{{ hostvars
  18. | lib_utils_oo_select_keys(groups.oo_etcd_hosts_to_backup)
  19. | lib_utils_oo_collect('inventory_hostname', {'r_etcd_common_backup_complete': true}) }}"
  20. - set_fact:
  21. etcd_backup_failed: "{{ groups.oo_etcd_hosts_to_backup | difference(etcd_backup_completed) | list }}"
  22. - fail:
  23. msg: "Upgrade cannot continue. The following hosts did not complete etcd backup: {{ etcd_backup_failed | join(',') }}"
  24. when: etcd_backup_failed | length > 0