You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

57 lines
2.1 KiB

  1. - name: "Pre-upgrade | check for etcd-proxy unit file"
  2. stat:
  3. path: /etc/systemd/system/etcd-proxy.service
  4. register: etcd_proxy_service_file
  5. tags: facts
  6. - name: "Pre-upgrade | check for etcd-proxy init script"
  7. stat:
  8. path: /etc/init.d/etcd-proxy
  9. register: etcd_proxy_init_script
  10. tags: facts
  11. - name: "Pre-upgrade | stop etcd-proxy if service defined"
  12. service:
  13. name: etcd-proxy
  14. state: stopped
  15. when: (etcd_proxy_service_file.stat.exists|default(False) or etcd_proxy_init_script.stat.exists|default(False))
  16. - name: "Pre-upgrade | remove etcd-proxy service definition"
  17. file:
  18. path: "{{ item }}"
  19. state: absent
  20. when: (etcd_proxy_service_file.stat.exists|default(False) or etcd_proxy_init_script.stat.exists|default(False))
  21. with_items:
  22. - /etc/systemd/system/etcd-proxy.service
  23. - /etc/init.d/etcd-proxy
  24. - name: "Pre-upgrade | find etcd-proxy container"
  25. command: "{{ docker_bin_dir }}/docker ps -aq --filter 'name=etcd-proxy*'"
  26. register: etcd_proxy_container
  27. failed_when: false
  28. - name: "Pre-upgrade | remove etcd-proxy if it exists"
  29. command: "{{ docker_bin_dir }}/docker rm -f {{item}}"
  30. with_items: "{{etcd_proxy_container.stdout_lines}}"
  31. - name: "Pre-upgrade | see if etcdctl is installed"
  32. stat:
  33. path: "{{ bin_dir }}/etcdctl"
  34. register: etcdctl_installed
  35. - name: "Pre-upgrade | check if member list is non-SSL"
  36. command: "{{ bin_dir }}/etcdctl --no-sync --peers={{ etcd_access_addresses | regex_replace('https','http') }} member list"
  37. register: etcd_member_list
  38. retries: 10
  39. delay: 3
  40. until: etcd_member_list.rc != 2
  41. run_once: true
  42. when: etcdctl_installed.stat.exists
  43. failed_when: false
  44. - name: "Pre-upgrade | change peer names to SSL"
  45. shell: >-
  46. {{ bin_dir }}/etcdctl --no-sync --peers={{ etcd_access_addresses | regex_replace('https','http') }} member list |
  47. awk -F"[: =]" '{print "{{ bin_dir }}/etcdctl --peers={{ etcd_access_addresses | regex_replace('https','http') }} member update "$1" https:"$7":"$8}' | bash
  48. run_once: true
  49. when: 'etcdctl_installed.stat.exists and etcd_member_list.rc == 0 and "http://" in etcd_member_list.stdout'