upgrade_backup.yml 984 B

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