diff options
author | Brenton Leanhardt <bleanhar@redhat.com> | 2016-05-16 14:16:32 -0400 |
---|---|---|
committer | Brenton Leanhardt <bleanhar@redhat.com> | 2016-05-16 14:16:32 -0400 |
commit | e3897f7be787ce729d51a150effe0fda9c08a08c (patch) | |
tree | 32596a5500e5322779a0a6ce9b8b44852e75f438 | |
parent | 6600c694bedf88a246c0f8a2cccb9ae3c34dc6ea (diff) | |
parent | 1b720085f2448794190e224011a07134b9425310 (diff) | |
download | openshift-e3897f7be787ce729d51a150effe0fda9c08a08c.tar.gz openshift-e3897f7be787ce729d51a150effe0fda9c08a08c.tar.bz2 openshift-e3897f7be787ce729d51a150effe0fda9c08a08c.tar.xz openshift-e3897f7be787ce729d51a150effe0fda9c08a08c.zip |
Merge pull request #1859 from dgoodwin/containerized-upgrade
Containerized Upgrade Fixes
-rw-r--r-- | playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/pre.yml | 3 | ||||
-rw-r--r-- | playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/upgrade.yml | 1 | ||||
-rw-r--r-- | roles/openshift_cli/meta/main.yml | 2 | ||||
-rw-r--r-- | roles/openshift_docker/tasks/main.yml | 25 | ||||
-rw-r--r-- | roles/openshift_node/handlers/main.yml | 7 | ||||
-rw-r--r-- | roles/openshift_node/tasks/systemd_units.yml | 2 |
6 files changed, 31 insertions, 9 deletions
diff --git a/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/pre.yml b/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/pre.yml index 1dd47dc15..ce589db2e 100644 --- a/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/pre.yml +++ b/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/pre.yml @@ -102,6 +102,7 @@ target_version: "{{ '1.2' if deployment_type == 'origin' else '3.1.1.900' }}" openshift_docker_hosted_registry_insecure: True openshift_docker_hosted_registry_network: "{{ hostvars[groups.oo_first_master.0].openshift.common.portal_net }}" + upgrading: True handlers: - include: ../../../../../roles/openshift_master/handlers/main.yml - include: ../../../../../roles/openshift_node/handlers/main.yml @@ -110,7 +111,7 @@ # are modified to use the correct image tag. However, this can trigger a # docker restart if new configuration is laid down which would immediately # pull the latest image and defeat the purpose of these tasks. - - openshift_cli + - { role: openshift_cli } pre_tasks: - name: Clean package cache command: "{{ ansible_pkg_mgr }} clean all" diff --git a/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/upgrade.yml b/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/upgrade.yml index a91727ecd..d15653a3b 100644 --- a/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/upgrade.yml +++ b/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/upgrade.yml @@ -130,6 +130,7 @@ ent_reconcile_bindings: true openshift_docker_hosted_registry_insecure: True openshift_docker_hosted_registry_network: "{{ hostvars[groups.oo_first_master.0].openshift.common.portal_net }}" + upgrading: True tasks: - name: Verifying the correct commandline tools are available shell: grep {{ verify_upgrade_version }} {{ openshift.common.admin_binary}} diff --git a/roles/openshift_cli/meta/main.yml b/roles/openshift_cli/meta/main.yml index 223cb768d..b97a1a277 100644 --- a/roles/openshift_cli/meta/main.yml +++ b/roles/openshift_cli/meta/main.yml @@ -12,6 +12,6 @@ galaxy_info: categories: - cloud dependencies: -- role: openshift_docker +- { role: openshift_docker, upgrading: "{{ upgrading | default(False) }}" } - role: openshift_common - role: openshift_cli_facts diff --git a/roles/openshift_docker/tasks/main.yml b/roles/openshift_docker/tasks/main.yml index 4e5cec82f..5d5174ec9 100644 --- a/roles/openshift_docker/tasks/main.yml +++ b/roles/openshift_docker/tasks/main.yml @@ -2,20 +2,37 @@ # It's important that we don't explicitly pull this image here. Otherwise we # could result in upgrading a preinstalled environment. We'll have to set # openshift_image_tag correctly for upgrades. + +- set_fact: + upgrading: False + when: upgrading is not defined + +- set_fact: + is_containerized: "{{ openshift.common.is_containerized | default(False) | bool }}" + # Does the host already have an image tag fact, used to determine if it's a new node + # in non-upgrade scenarios: + has_image_tag_fact: "{{ hostvars[inventory_hostname].openshift.docker.openshift_image_tag is defined }}" + - name: Set version when containerized command: > docker run --rm {{ openshift.common.cli_image }} version register: cli_image_version - when: openshift.common.is_containerized is defined and openshift.common.is_containerized | bool and openshift_image_tag is not defined + when: is_containerized | bool and openshift_image_tag is not defined and (upgrading | bool or not has_image_tag_fact | bool) + +# Use the pre-existing image tag from system facts if present, and we're not upgrading. +# Ignores explicit openshift_image_tag if it's in the inventory, as this isn't an upgrade. +- set_fact: + l_image_tag: "{{ hostvars[inventory_hostname].openshift.docker.openshift_image_tag }}" + when: is_containerized | bool and not upgrading | bool and has_image_tag_fact | bool - set_fact: l_image_tag: "{{ cli_image_version.stdout_lines[0].split(' ')[1].split('-')[0:2] | join('-') if openshift.common.deployment_type == 'origin' else cli_image_version.stdout_lines[0].split(' ')[1].split('-')[0] }}" - when: openshift.common.is_containerized is defined and openshift.common.is_containerized | bool and openshift_image_tag is not defined + when: is_containerized | bool and openshift_image_tag is not defined and (upgrading | bool or not has_image_tag_fact | bool) - set_fact: l_image_tag: "{{ openshift_image_tag }}" - when: openshift.common.is_containerized is defined and openshift.common.is_containerized | bool and openshift_image_tag is defined + when: is_containerized | bool and openshift_image_tag is defined and (upgrading | bool or not has_image_tag_fact | bool) - name: Set post docker install facts openshift_facts: @@ -26,4 +43,4 @@ local_facts: openshift_image_tag: "{{ l_image_tag | default(None) }}" openshift_version: "{{ l_image_tag.split('-')[0] | oo_image_tag_to_rpm_version if l_image_tag is defined else '' }}" - when: openshift.common.is_containerized is defined and openshift.common.is_containerized | bool + when: is_containerized | bool diff --git a/roles/openshift_node/handlers/main.yml b/roles/openshift_node/handlers/main.yml index 1a1dc8ede..df3f6ee65 100644 --- a/roles/openshift_node/handlers/main.yml +++ b/roles/openshift_node/handlers/main.yml @@ -1,8 +1,9 @@ --- +- name: restart openvswitch + service: name=openvswitch state=restarted + when: not (ovs_service_status_changed | default(false) | bool) + - name: restart node service: name={{ openshift.common.service_type }}-node state=restarted when: not (node_service_status_changed | default(false) | bool) -- name: restart openvswitch - service: name=openvswitch state=restarted - when: not (ovs_service_status_changed | default(false) | bool) diff --git a/roles/openshift_node/tasks/systemd_units.yml b/roles/openshift_node/tasks/systemd_units.yml index be4b4ed61..f3262803a 100644 --- a/roles/openshift_node/tasks/systemd_units.yml +++ b/roles/openshift_node/tasks/systemd_units.yml @@ -14,6 +14,8 @@ dest: /etc/sysconfig/openvswitch when: openshift.common.is_containerized | bool register: install_ovs_sysconfig + notify: + - restart openvswitch - name: Install OpenvSwitch docker service file template: |