backup.yml 1.1 KB

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