summaryrefslogtreecommitdiffstats
path: root/playbooks/common
diff options
context:
space:
mode:
authorScott Dodson <sdodson@redhat.com>2017-02-02 09:17:08 -0500
committerGitHub <noreply@github.com>2017-02-02 09:17:08 -0500
commit4dfe8c715bfc49a913d7c7bea80c475a9b50b41e (patch)
tree764be64a50670d9aeda1798ecdbe8746a14a7b4b /playbooks/common
parentc9480811d2222693abe4460ca42c292b289a0ef4 (diff)
parent43ecd7bf94d5be4209e46d66a9f9bd9614d85a76 (diff)
downloadopenshift-4dfe8c715bfc49a913d7c7bea80c475a9b50b41e.tar.gz
openshift-4dfe8c715bfc49a913d7c7bea80c475a9b50b41e.tar.bz2
openshift-4dfe8c715bfc49a913d7c7bea80c475a9b50b41e.tar.xz
openshift-4dfe8c715bfc49a913d7c7bea80c475a9b50b41e.zip
Merge pull request #3242 from ingvagabund/create-node-upgrade-role
Move current node upgrade tasks under openshift_node_upgrade role
Diffstat (limited to 'playbooks/common')
-rw-r--r--playbooks/common/openshift-cluster/upgrades/upgrade_nodes.yml87
1 files changed, 7 insertions, 80 deletions
diff --git a/playbooks/common/openshift-cluster/upgrades/upgrade_nodes.yml b/playbooks/common/openshift-cluster/upgrades/upgrade_nodes.yml
index a6a49e5ff..c0746a9e6 100644
--- a/playbooks/common/openshift-cluster/upgrades/upgrade_nodes.yml
+++ b/playbooks/common/openshift-cluster/upgrades/upgrade_nodes.yml
@@ -5,12 +5,7 @@
# and is evaluated early. Values such as "20%" can also be used.
serial: "{{ openshift_upgrade_nodes_serial | default(1) }}"
any_errors_fatal: true
- roles:
- - openshift_facts
- - docker
- handlers:
- - include: ../../../../roles/openshift_node/handlers/main.yml
- static: yes
+
pre_tasks:
# TODO: To better handle re-trying failed upgrades, it would be nice to check if the node
# or docker actually needs an upgrade before proceeding. Perhaps best to save this until
@@ -21,17 +16,14 @@
register: node_output
delegate_to: "{{ groups.oo_first_master.0 }}"
changed_when: false
- when: inventory_hostname in groups.oo_nodes_to_upgrade
- set_fact:
was_schedulable: "{{ 'unschedulable' not in (node_output.stdout | from_json).spec }}"
- when: inventory_hostname in groups.oo_nodes_to_upgrade
- name: Mark unschedulable if host is a node
command: >
{{ hostvars[groups.oo_first_master.0].openshift.common.client_binary }} adm manage-node {{ openshift.node.nodename | lower }} --schedulable=false
delegate_to: "{{ groups.oo_first_master.0 }}"
- when: inventory_hostname in groups.oo_nodes_to_upgrade
# NOTE: There is a transient "object has been modified" error here, allow a couple
# retries for a more reliable upgrade.
register: node_unsched
@@ -43,83 +35,18 @@
command: >
{{ hostvars[groups.oo_first_master.0].openshift.common.admin_binary }} drain {{ openshift.node.nodename | lower }} --force --delete-local-data
delegate_to: "{{ groups.oo_first_master.0 }}"
- when: inventory_hostname in groups.oo_nodes_to_upgrade
-
- tasks:
-
- - include: docker/upgrade.yml
- vars:
- # We will restart Docker ourselves after everything is ready:
- skip_docker_restart: True
- when: l_docker_upgrade is defined and l_docker_upgrade | bool and not openshift.common.is_atomic | bool
-
- - include: "{{ node_config_hook }}"
- when: node_config_hook is defined and inventory_hostname in groups.oo_nodes_to_upgrade
-
- - include: rpm_upgrade.yml
- vars:
- component: "node"
- openshift_version: "{{ openshift_pkg_version | default('') }}"
- when: inventory_hostname in groups.oo_nodes_to_upgrade and not openshift.common.is_containerized | bool
-
- - name: Remove obsolete docker-sdn-ovs.conf
- file: path=/etc/systemd/system/docker.service.d/docker-sdn-ovs.conf state=absent
- when: (deployment_type == 'openshift-enterprise' and openshift_release | version_compare('3.4', '>=')) or (deployment_type == 'origin' and openshift_release | version_compare('1.4', '>='))
-
- - include: containerized_node_upgrade.yml
- when: inventory_hostname in groups.oo_nodes_to_upgrade and openshift.common.is_containerized | bool
-
- - name: Ensure containerized services stopped before Docker restart
- service: name={{ item }} state=stopped
- with_items:
- - etcd_container
- - openvswitch
- - "{{ openshift.common.service_type }}-master"
- - "{{ openshift.common.service_type }}-master-api"
- - "{{ openshift.common.service_type }}-master-controllers"
- - "{{ openshift.common.service_type }}-node"
- failed_when: false
- when: openshift.common.is_containerized | bool
- - name: Upgrade openvswitch
- package:
- name: openvswitch
- state: latest
- register: ovs_pkg
- when: inventory_hostname in groups.oo_nodes_to_upgrade and not openshift.common.is_containerized | bool
-
- - name: Restart openvswitch
- systemd:
- name: openvswitch
- state: restarted
- when:
- - inventory_hostname in groups.oo_nodes_to_upgrade and not openshift.common.is_containerized | bool
- - ovs_pkg | changed
-
- # Mandatory Docker restart, ensure all containerized services are running:
- - include: docker/restart.yml
-
- - name: Restart rpm node service
- service: name="{{ openshift.common.service_type }}-node" state=restarted
- when: inventory_hostname in groups.oo_nodes_to_upgrade and not openshift.common.is_containerized | bool
-
- - name: Wait for node to be ready
- command: >
- {{ hostvars[groups.oo_first_master.0].openshift.common.client_binary }} get node {{ openshift.common.hostname | lower }} --no-headers
- register: node_output
- delegate_to: "{{ groups.oo_first_master.0 }}"
- when: inventory_hostname in groups.oo_nodes_to_upgrade
- until: "{{ node_output.stdout.split()[1].startswith('Ready')}}"
- # Give the node two minutes to come back online. Note that we pre-pull images now
- # so containerized services should restart quickly as well.
- retries: 24
- delay: 5
+ roles:
+ - openshift_facts
+ - docker
+ - openshift_node_upgrade
+ post_tasks:
- name: Set node schedulability
command: >
{{ hostvars[groups.oo_first_master.0].openshift.common.client_binary }} adm manage-node {{ openshift.node.nodename | lower }} --schedulable=true
delegate_to: "{{ groups.oo_first_master.0 }}"
- when: inventory_hostname in groups.oo_nodes_to_upgrade and was_schedulable | bool
+ when: was_schedulable | bool
register: node_sched
until: node_sched.rc == 0
retries: 3