upgrade_static.yml 1.3 KB

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