upgrade_static.yml 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. ---
  2. # PREREQ Node service is ready to run static pods
  3. # INPUT r_etcd_upgrade_version
  4. - include_tasks: runtime.yml
  5. - name: Verify cluster is healthy pre-upgrade
  6. command: "{{ etcdctlv2 }} cluster-health"
  7. - name: Check for old etcd service files
  8. stat:
  9. path: "{{ item }}"
  10. with_items:
  11. - "/etc/systemd/system/etcd.service"
  12. - "/etc/systemd/system/etcd_container.service"
  13. register: old_svc_files
  14. - name: Remove old etcd service files
  15. file:
  16. path: "{{ item.stat.path }}"
  17. state: absent
  18. with_items:
  19. - "{{ old_svc_files.results }}"
  20. when:
  21. - item.stat.exists
  22. - item.stat.isreg
  23. # We removed the ability to detect what was previously 'containerized'
  24. # Need to stop and disable this service, but might not be present.
  25. - name: Stop, disable and mask old etcd service
  26. systemd:
  27. name: "{{ item }}"
  28. state: stopped
  29. enabled: no
  30. masked: yes
  31. daemon_reload: yes
  32. with_items:
  33. - etcd
  34. - etcd_container
  35. failed_when: False
  36. - name: Remove nonexistent services
  37. command: "systemctl reset-failed"
  38. - name: Configure static definition
  39. import_tasks: static.yml
  40. - set_fact:
  41. r_etcd_common_etcd_runtime: static_pod
  42. - name: Verify cluster is healthy
  43. command: "{{ etcdctlv2 }} cluster-health"
  44. register: etcdctl
  45. until: etcdctl.rc == 0 and 'stopped' not in etcdctl.stderr
  46. retries: 30
  47. delay: 10