upgrade_backup.yml 971 B

1234567891011121314151617181920212223242526
  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. tasks:
  17. - set_fact:
  18. etcd_backup_completed: "{{ hostvars
  19. | lib_utils_oo_select_keys(groups.oo_etcd_hosts_to_backup)
  20. | lib_utils_oo_collect('inventory_hostname', {'r_etcd_common_backup_complete': true}) }}"
  21. - set_fact:
  22. etcd_backup_failed: "{{ groups.oo_etcd_hosts_to_backup | difference(etcd_backup_completed) | list }}"
  23. - fail:
  24. msg: "Upgrade cannot continue. The following hosts did not complete etcd backup: {{ etcd_backup_failed | join(',') }}"
  25. when: etcd_backup_failed | length > 0