summaryrefslogtreecommitdiffstats
path: root/roles/openshift_node/tasks/upgrade
diff options
context:
space:
mode:
authorMichael Gugino <mgugino@redhat.com>2017-11-09 17:00:00 -0500
committerMichael Gugino <mgugino@redhat.com>2017-11-16 09:03:35 -0500
commitafa4fd5799b0ff43d625d061e4c2bde66b5fb86a (patch)
tree2654bb42deb7dcd3b907b1476ec0fbe55c133fb2 /roles/openshift_node/tasks/upgrade
parent8a85bc3a00efb654238a58e1faa2a2629d9360b1 (diff)
downloadopenshift-afa4fd5799b0ff43d625d061e4c2bde66b5fb86a.tar.gz
openshift-afa4fd5799b0ff43d625d061e4c2bde66b5fb86a.tar.bz2
openshift-afa4fd5799b0ff43d625d061e4c2bde66b5fb86a.tar.xz
openshift-afa4fd5799b0ff43d625d061e4c2bde66b5fb86a.zip
Combine openshift_node and openshift_node_upgrade
Currently, having openshift_node and openshift_node_upgrade as two distinct roles has created a duplication across handlers, templates, and some tasks. This commit combines the roles to reduce duplication and bugs encountered by not putting code in both places.
Diffstat (limited to 'roles/openshift_node/tasks/upgrade')
-rw-r--r--roles/openshift_node/tasks/upgrade/containerized_node_upgrade.yml14
-rw-r--r--roles/openshift_node/tasks/upgrade/restart.yml46
-rw-r--r--roles/openshift_node/tasks/upgrade/rpm_upgrade.yml29
3 files changed, 89 insertions, 0 deletions
diff --git a/roles/openshift_node/tasks/upgrade/containerized_node_upgrade.yml b/roles/openshift_node/tasks/upgrade/containerized_node_upgrade.yml
new file mode 100644
index 000000000..96b94d8b6
--- /dev/null
+++ b/roles/openshift_node/tasks/upgrade/containerized_node_upgrade.yml
@@ -0,0 +1,14 @@
+---
+# This is a hack to allow us to use systemd_units.yml, but skip the handlers which
+# restart services. We will unconditionally restart all containerized services
+# because we have to unconditionally restart Docker:
+- set_fact:
+ skip_node_svc_handlers: True
+
+- name: Update systemd units
+ include: ../systemd_units.yml
+
+# This is a no-op because of skip_node_svc_handlers, but lets us trigger it before end of
+# play when the node has already been marked schedulable again. (this would look strange
+# in logs otherwise)
+- meta: flush_handlers
diff --git a/roles/openshift_node/tasks/upgrade/restart.yml b/roles/openshift_node/tasks/upgrade/restart.yml
new file mode 100644
index 000000000..a4fa51172
--- /dev/null
+++ b/roles/openshift_node/tasks/upgrade/restart.yml
@@ -0,0 +1,46 @@
+---
+# input variables:
+# - openshift.common.service_type
+# - openshift.common.is_containerized
+# - openshift.common.hostname
+# - openshift.master.api_port
+
+# NOTE: This is needed to make sure we are using the correct set
+# of systemd unit files. The RPMs lay down defaults but
+# the install/upgrade may override them in /etc/systemd/system/.
+# NOTE: We don't use the systemd module as some versions of the module
+# require a service to be part of the call.
+- name: Reload systemd to ensure latest unit files
+ command: systemctl daemon-reload
+
+- name: Restart docker
+ service:
+ name: "{{ openshift.docker.service_name }}"
+ state: started
+ register: docker_start_result
+ until: not docker_start_result | failed
+ retries: 3
+ delay: 30
+
+- name: Update docker facts
+ openshift_facts:
+ role: docker
+
+- name: Start services
+ service: name={{ item }} state=started
+ with_items:
+ - etcd_container
+ - openvswitch
+ - "{{ openshift.common.service_type }}-master-api"
+ - "{{ openshift.common.service_type }}-master-controllers"
+ - "{{ openshift.common.service_type }}-node"
+ failed_when: false
+
+- name: Wait for master API to come back online
+ wait_for:
+ host: "{{ openshift.common.hostname }}"
+ state: started
+ delay: 10
+ port: "{{ openshift.master.api_port }}"
+ timeout: 600
+ when: inventory_hostname in groups.oo_masters_to_config
diff --git a/roles/openshift_node/tasks/upgrade/rpm_upgrade.yml b/roles/openshift_node/tasks/upgrade/rpm_upgrade.yml
new file mode 100644
index 000000000..a998acf21
--- /dev/null
+++ b/roles/openshift_node/tasks/upgrade/rpm_upgrade.yml
@@ -0,0 +1,29 @@
+---
+# input variables:
+# - openshift.common.service_type
+# - component
+# - openshift_pkg_version
+# - openshift.common.is_atomic
+
+# We verified latest rpm available is suitable, so just yum update.
+- name: Upgrade packages
+ package: "name={{ openshift.common.service_type }}-{{ component }}{{ openshift_pkg_version }} state=present"
+
+- name: Ensure python-yaml present for config upgrade
+ package: name=PyYAML state=present
+ when: not openshift.common.is_atomic | bool
+
+- name: Install Node service file
+ template:
+ dest: "/etc/systemd/system/{{ openshift.common.service_type }}-node.service"
+ src: "node.service.j2"
+ register: l_node_unit
+
+# NOTE: This is needed to make sure we are using the correct set
+# of systemd unit files. The RPMs lay down defaults but
+# the install/upgrade may override them in /etc/systemd/system/.
+# NOTE: We don't use the systemd module as some versions of the module
+# require a service to be part of the call.
+- name: Reload systemd units
+ command: systemctl daemon-reload
+ when: l_node_unit | changed