diff options
author | Jan Chaloupka <jchaloup@redhat.com> | 2017-02-01 13:57:56 +0100 |
---|---|---|
committer | Jan Chaloupka <jchaloup@redhat.com> | 2017-02-01 16:45:14 +0100 |
commit | 9221ef2b06df897b1ae7150431cd2c8dda473624 (patch) | |
tree | 2813d11a50affea7c25a6f9b7397d567cadc915f /playbooks | |
parent | 80c24368564e2b8328c63d21902f54cb3ea12c4d (diff) | |
download | openshift-9221ef2b06df897b1ae7150431cd2c8dda473624.tar.gz openshift-9221ef2b06df897b1ae7150431cd2c8dda473624.tar.bz2 openshift-9221ef2b06df897b1ae7150431cd2c8dda473624.tar.xz openshift-9221ef2b06df897b1ae7150431cd2c8dda473624.zip |
Move current node upgrade tasks under openshift_node_upgrade role
Diffstat (limited to 'playbooks')
-rw-r--r-- | playbooks/common/openshift-cluster/upgrades/upgrade_nodes.yml | 87 |
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 |