upgrade_static.yml 1.4 KB

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