From e1df3b6ba7b78255c8022468e9ad1a32255e5e59 Mon Sep 17 00:00:00 2001 From: Michael Gugino Date: Fri, 8 Dec 2017 13:38:03 -0500 Subject: Refactor upgrade codepaths step 1 This commit refactors some upgrade code paths. Touched areas are: 1) Reduces usage of 'oo_all_hosts' in various places, especially when running upgrade_control_plane. 2) Reuses common code across the various upgrade* playbooks. 3) Moves docker upgrade checks into container_runtime_role. 4) Combines smaller playbooks and plays to reduce file sprawl. --- .../openshift-cluster/upgrades/v3_7/upgrade.yml | 103 +++------------------ 1 file changed, 12 insertions(+), 91 deletions(-) (limited to 'playbooks/common/openshift-cluster/upgrades/v3_7/upgrade.yml') diff --git a/playbooks/common/openshift-cluster/upgrades/v3_7/upgrade.yml b/playbooks/common/openshift-cluster/upgrades/v3_7/upgrade.yml index 9ec788e76..4daa9e490 100644 --- a/playbooks/common/openshift-cluster/upgrades/v3_7/upgrade.yml +++ b/playbooks/common/openshift-cluster/upgrades/v3_7/upgrade.yml @@ -15,103 +15,24 @@ openshift_upgrade_target: '3.7' openshift_upgrade_min: '3.6' -# Pre-upgrade - -- import_playbook: ../initialize_nodes_to_upgrade.yml - tags: - - pre_upgrade - -- import_playbook: ../pre/verify_etcd3_backend.yml - tags: - - pre_upgrade - -- name: Update repos and initialize facts on all hosts - hosts: oo_masters_to_config:oo_nodes_to_upgrade:oo_etcd_to_config:oo_lb_to_config - tags: - - pre_upgrade - roles: - - openshift_repos - -- name: Set openshift_no_proxy_internal_hostnames - hosts: oo_masters_to_config:oo_nodes_to_upgrade - tags: - - pre_upgrade - tasks: - - set_fact: - openshift_no_proxy_internal_hostnames: "{{ hostvars | oo_select_keys(groups['oo_nodes_to_config'] - | union(groups['oo_masters_to_config']) - | union(groups['oo_etcd_to_config'] | default([]))) - | oo_collect('openshift.common.hostname') | default([]) | join (',') - }}" - when: - - openshift_http_proxy is defined or openshift_https_proxy is defined - - openshift_generate_no_proxy_hosts | default(True) | bool - -- import_playbook: ../pre/verify_inventory_vars.yml - tags: - - pre_upgrade - -- import_playbook: ../pre/verify_health_checks.yml - tags: - - pre_upgrade - -- import_playbook: ../pre/verify_control_plane_running.yml - tags: - - pre_upgrade - -- import_playbook: ../disable_master_excluders.yml - tags: - - pre_upgrade - -- import_playbook: ../disable_node_excluders.yml - tags: - - pre_upgrade - -- import_playbook: ../../../../init/version.yml - tags: - - pre_upgrade +- import_playbook: ../pre/config.yml vars: - # Request specific openshift_release and let the openshift_version role handle converting this - # to a more specific version, respecting openshift_image_tag and openshift_pkg_version if - # defined, and overriding the normal behavior of protecting the installed version - openshift_release: "{{ openshift_upgrade_target }}" - openshift_protect_installed_version: False - -- import_playbook: ../../../../openshift-master/private/validate_restart.yml - tags: - - pre_upgrade - -- name: Verify upgrade targets - hosts: oo_masters_to_config:oo_nodes_to_upgrade - tasks: - - include_tasks: ../pre/verify_upgrade_targets.yml - tags: - - pre_upgrade - -- name: Verify docker upgrade targets - hosts: oo_masters_to_config:oo_nodes_to_upgrade:oo_etcd_to_config - tasks: - - include_tasks: ../pre/tasks/verify_docker_upgrade_targets.yml - tags: - - pre_upgrade + l_upgrade_repo_hosts: "oo_masters_to_config:oo_nodes_to_upgrade:oo_etcd_to_config:oo_lb_to_config" + l_upgrade_no_proxy_hosts: "oo_masters_to_config:oo_nodes_to_upgrade" + l_upgrade_health_check_hosts: "oo_masters_to_config:oo_etcd_to_config:oo_lb_to_config" + l_upgrade_verify_targets_hosts: "oo_masters_to_config:oo_nodes_to_upgrade" + l_upgrade_docker_target_hosts: "oo_masters_to_config:oo_nodes_to_upgrade:oo_etcd_to_config" + l_upgrade_excluder_hosts: "oo_nodes_to_config:oo_masters_to_config" - import_playbook: validator.yml - tags: - - pre_upgrade -- import_playbook: ../pre/gate_checks.yml - tags: - - pre_upgrade - -# Pre-upgrade completed, nothing after this should be tagged pre_upgrade. - -# Separate step so we can execute in parallel and clear out anything unused -# before we get into the serialized upgrade process which will then remove -# remaining images if possible. -- name: Cleanup unused Docker images +- name: Flag pre-upgrade checks complete for hosts without errors hosts: oo_masters_to_config:oo_nodes_to_upgrade:oo_etcd_to_config tasks: - - include_tasks: ../cleanup_unused_images.yml + - set_fact: + pre_upgrade_complete: True + +# Pre-upgrade completed - import_playbook: ../upgrade_control_plane.yml vars: -- cgit v1.2.1