summaryrefslogtreecommitdiffstats
path: root/roles/etcd/tasks
diff options
context:
space:
mode:
authorMichael Gugino <gugino.michael@yahoo.com>2017-11-22 09:08:19 -0500
committerGitHub <noreply@github.com>2017-11-22 09:08:19 -0500
commit4f83051b3b7c80e3ad71fc28108cd1fc3646b385 (patch)
treeee55d37f54a05008201b29b8afcd22cf2d4ac234 /roles/etcd/tasks
parent46ce19180bf4fe05327ab8a15bb689d908779e75 (diff)
parenta1fa70c1ac6fbe9a4c8ca740b2c6c3cf5ff27ef1 (diff)
downloadopenshift-4f83051b3b7c80e3ad71fc28108cd1fc3646b385.tar.gz
openshift-4f83051b3b7c80e3ad71fc28108cd1fc3646b385.tar.bz2
openshift-4f83051b3b7c80e3ad71fc28108cd1fc3646b385.tar.xz
openshift-4f83051b3b7c80e3ad71fc28108cd1fc3646b385.zip
Merge pull request #6193 from mgugino-upstream-stage/etc-runtime
Cleanup etcd runtime variable.
Diffstat (limited to 'roles/etcd/tasks')
-rw-r--r--roles/etcd/tasks/main.yml8
-rw-r--r--roles/etcd/tasks/restart.yml21
-rw-r--r--roles/etcd/tasks/version_detect.yml55
3 files changed, 80 insertions, 4 deletions
diff --git a/roles/etcd/tasks/main.yml b/roles/etcd/tasks/main.yml
index fabe66b91..78ec2cedb 100644
--- a/roles/etcd/tasks/main.yml
+++ b/roles/etcd/tasks/main.yml
@@ -30,7 +30,7 @@
src: etcd.docker.service
when:
- etcd_is_containerized | bool
- - not openshift.common.is_etcd_system_container | bool
+ - not l_is_etcd_system_container | bool
# Start secondary etcd instance for third party integrations
# TODO: Determine an alternative to using thirdparty variable
@@ -90,7 +90,7 @@
enabled: no
masked: yes
daemon_reload: yes
- when: not openshift.common.is_etcd_system_container | bool
+ when: not l_is_etcd_system_container | bool
register: task_result
failed_when: task_result|failed and 'could not' not in task_result.msg|lower
@@ -98,11 +98,11 @@
template:
dest: "/etc/systemd/system/etcd_container.service"
src: etcd.docker.service
- when: not openshift.common.is_etcd_system_container | bool
+ when: not l_is_etcd_system_container | bool
- name: Install Etcd system container
include: system_container.yml
- when: openshift.common.is_etcd_system_container | bool
+ when: l_is_etcd_system_container | bool
when: etcd_is_containerized | bool
- name: Validate permissions on the config dir
diff --git a/roles/etcd/tasks/restart.yml b/roles/etcd/tasks/restart.yml
new file mode 100644
index 000000000..d4a016eec
--- /dev/null
+++ b/roles/etcd/tasks/restart.yml
@@ -0,0 +1,21 @@
+---
+
+- name: restart etcd
+ service:
+ name: "{{ etcd_service }}"
+ state: restarted
+ when:
+ - not g_etcd_certificates_expired | default(false) | bool
+
+- name: stop etcd
+ service:
+ name: "{{ etcd_service }}"
+ state: stopped
+ when:
+ - g_etcd_certificates_expired | default(false) | bool
+- name: start etcd
+ service:
+ name: "{{ etcd_service }}"
+ state: started
+ when:
+ - g_etcd_certificates_expired | default(false) | bool
diff --git a/roles/etcd/tasks/version_detect.yml b/roles/etcd/tasks/version_detect.yml
new file mode 100644
index 000000000..fe1e418d8
--- /dev/null
+++ b/roles/etcd/tasks/version_detect.yml
@@ -0,0 +1,55 @@
+---
+- block:
+ - name: Record RPM based etcd version
+ command: rpm -qa --qf '%{version}' etcd\*
+ args:
+ warn: no
+ register: etcd_rpm_version
+ failed_when: false
+ # AUDIT:changed_when: `false` because we are only inspecting
+ # state, not manipulating anything
+ changed_when: false
+ - debug:
+ msg: "Etcd rpm version {{ etcd_rpm_version.stdout }} detected"
+ when:
+ - not openshift.common.is_containerized | bool
+
+- block:
+ - name: Record containerized etcd version (docker)
+ command: docker exec etcd_container rpm -qa --qf '%{version}' etcd\*
+ register: etcd_container_version_docker
+ failed_when: false
+ # AUDIT:changed_when: `false` because we are only inspecting
+ # state, not manipulating anything
+ changed_when: false
+ when:
+ - not l_is_etcd_system_container | bool
+
+ # Given a register variables is set even if the whwen condition
+ # is false, we need to set etcd_container_version separately
+ - set_fact:
+ etcd_container_version: "{{ etcd_container_version_docker.stdout }}"
+ when:
+ - not l_is_etcd_system_container | bool
+
+ - name: Record containerized etcd version (runc)
+ command: runc exec etcd rpm -qa --qf '%{version}' etcd\*
+ register: etcd_container_version_runc
+ failed_when: false
+ # AUDIT:changed_when: `false` because we are only inspecting
+ # state, not manipulating anything
+ changed_when: false
+ when:
+ - l_is_etcd_system_container | bool
+
+ # Given a register variables is set even if the whwen condition
+ # is false, we need to set etcd_container_version separately
+ - set_fact:
+ etcd_container_version: "{{ etcd_container_version_runc.stdout }}"
+ when:
+ - l_is_etcd_system_container | bool
+
+ - debug:
+ msg: "Etcd containerized version {{ etcd_container_version }} detected"
+ when:
+ - openshift.common.is_containerized | bool