upgrade_backup.yml 926 B

123456789101112131415161718192021222324
  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. - name: Gate on etcd backup
  12. hosts: localhost
  13. connection: local
  14. tasks:
  15. - set_fact:
  16. etcd_backup_completed: "{{ hostvars
  17. | lib_utils_oo_select_keys(groups.oo_etcd_hosts_to_backup)
  18. | lib_utils_oo_collect('inventory_hostname', {'r_etcd_common_backup_complete': true}) }}"
  19. - set_fact:
  20. etcd_backup_failed: "{{ groups.oo_etcd_hosts_to_backup | difference(etcd_backup_completed) | list }}"
  21. - fail:
  22. msg: "Upgrade cannot continue. The following hosts did not complete etcd backup: {{ etcd_backup_failed | join(',') }}"
  23. when: etcd_backup_failed | length > 0