2017-08-24 09:09:52 +00:00
|
|
|
---
|
2016-11-09 10:44:41 +00:00
|
|
|
- name: "Pre-upgrade | check for etcd-proxy unit file"
|
|
|
|
stat:
|
|
|
|
path: /etc/systemd/system/etcd-proxy.service
|
2016-12-19 12:05:49 +00:00
|
|
|
register: etcd_proxy_service_file
|
2016-12-08 13:36:00 +00:00
|
|
|
tags: facts
|
2016-11-09 10:44:41 +00:00
|
|
|
|
|
|
|
- name: "Pre-upgrade | check for etcd-proxy init script"
|
|
|
|
stat:
|
|
|
|
path: /etc/init.d/etcd-proxy
|
2016-12-19 12:05:49 +00:00
|
|
|
register: etcd_proxy_init_script
|
2016-12-08 13:36:00 +00:00
|
|
|
tags: facts
|
2016-11-09 10:44:41 +00:00
|
|
|
|
|
|
|
- name: "Pre-upgrade | stop etcd-proxy if service defined"
|
|
|
|
service:
|
|
|
|
name: etcd-proxy
|
|
|
|
state: stopped
|
2016-12-19 12:05:49 +00:00
|
|
|
when: (etcd_proxy_service_file.stat.exists|default(False) or etcd_proxy_init_script.stat.exists|default(False))
|
2016-11-09 10:44:41 +00:00
|
|
|
|
|
|
|
- name: "Pre-upgrade | remove etcd-proxy service definition"
|
|
|
|
file:
|
|
|
|
path: "{{ item }}"
|
|
|
|
state: absent
|
2016-12-19 12:05:49 +00:00
|
|
|
when: (etcd_proxy_service_file.stat.exists|default(False) or etcd_proxy_init_script.stat.exists|default(False))
|
2016-11-09 10:44:41 +00:00
|
|
|
with_items:
|
|
|
|
- /etc/systemd/system/etcd-proxy.service
|
|
|
|
- /etc/init.d/etcd-proxy
|
|
|
|
|
|
|
|
- name: "Pre-upgrade | find etcd-proxy container"
|
2016-12-23 14:44:44 +00:00
|
|
|
command: "{{ docker_bin_dir }}/docker ps -aq --filter 'name=etcd-proxy*'"
|
2016-11-09 10:44:41 +00:00
|
|
|
register: etcd_proxy_container
|
2017-03-15 11:00:42 +00:00
|
|
|
changed_when: false
|
2016-12-27 11:38:54 +00:00
|
|
|
failed_when: false
|
2016-11-09 10:44:41 +00:00
|
|
|
|
|
|
|
- name: "Pre-upgrade | remove etcd-proxy if it exists"
|
2016-12-23 14:44:44 +00:00
|
|
|
command: "{{ docker_bin_dir }}/docker rm -f {{item}}"
|
2017-09-01 06:02:23 +00:00
|
|
|
with_items: "{{etcd_proxy_container.stdout_lines|default()}}"
|
2016-11-09 10:44:41 +00:00
|
|
|
|
2017-02-20 14:17:15 +00:00
|
|
|
- name: "Pre-upgrade | see if etcdctl is installed"
|
|
|
|
stat:
|
|
|
|
path: "{{ bin_dir }}/etcdctl"
|
|
|
|
register: etcdctl_installed
|
|
|
|
|
2016-12-14 13:44:14 +00:00
|
|
|
- name: "Pre-upgrade | check if member list is non-SSL"
|
2016-12-19 12:05:49 +00:00
|
|
|
command: "{{ bin_dir }}/etcdctl --no-sync --peers={{ etcd_access_addresses | regex_replace('https','http') }} member list"
|
2016-12-14 13:44:14 +00:00
|
|
|
register: etcd_member_list
|
2016-12-19 12:05:49 +00:00
|
|
|
retries: 10
|
|
|
|
delay: 3
|
|
|
|
until: etcd_member_list.rc != 2
|
|
|
|
run_once: true
|
2017-02-20 14:17:15 +00:00
|
|
|
when: etcdctl_installed.stat.exists
|
2017-03-15 11:00:42 +00:00
|
|
|
changed_when: false
|
2016-12-27 11:38:54 +00:00
|
|
|
failed_when: false
|
2016-12-14 13:44:14 +00:00
|
|
|
|
|
|
|
- name: "Pre-upgrade | change peer names to SSL"
|
|
|
|
shell: >-
|
2016-12-19 12:05:49 +00:00
|
|
|
{{ bin_dir }}/etcdctl --no-sync --peers={{ etcd_access_addresses | regex_replace('https','http') }} member list |
|
|
|
|
awk -F"[: =]" '{print "{{ bin_dir }}/etcdctl --peers={{ etcd_access_addresses | regex_replace('https','http') }} member update "$1" https:"$7":"$8}' | bash
|
|
|
|
run_once: true
|
2017-02-20 14:17:15 +00:00
|
|
|
when: 'etcdctl_installed.stat.exists and etcd_member_list.rc == 0 and "http://" in etcd_member_list.stdout'
|