Browse Source

Add call to 3.8 playbook in 3.9 upgrade

Scott Dodson 7 years ago
parent
commit
dd9a27ad14

+ 1 - 0
playbooks/common/openshift-cluster/upgrades/v3_8/upgrade_control_plane.yml

@@ -14,6 +14,7 @@
 - import_playbook: ../init.yml
   vars:
     l_upgrade_no_switch_firewall_hosts: "oo_masters_to_config:oo_etcd_to_config:oo_lb_to_config"
+    l_upgrade_non_node_hosts: "oo_masters_to_config:oo_etcd_to_config:oo_lb_to_config"
   when: not skip_version_info | default(false)
 
 - name: Configure the upgrade target for the common upgrade tasks

+ 1 - 0
playbooks/common/openshift-cluster/upgrades/v3_9/upgrade.yml

@@ -10,6 +10,7 @@
   - set_fact:
       openshift_upgrade_target: '3.9'
       openshift_upgrade_min: '3.7'
+      openshift_release: '3.9'
 
 - import_playbook: ../pre/config.yml
   vars:

+ 49 - 5
playbooks/common/openshift-cluster/upgrades/v3_9/upgrade_control_plane.yml

@@ -16,12 +16,18 @@
     l_upgrade_no_switch_firewall_hosts: "oo_masters_to_config:oo_etcd_to_config:oo_lb_to_config"
     l_upgrade_non_node_hosts: "oo_masters_to_config:oo_etcd_to_config:oo_lb_to_config"
 
-- name: Configure the upgrade target for the common upgrade tasks
+## Check to see if they're running 3.7 and if so upgrade them to 3.8 on control plan
+## If they've specified pkg_version or image_tag preserve that for later use
+- name: Configure the upgrade target for the common upgrade tasks 3.8
   hosts: oo_masters_to_config:oo_etcd_to_config:oo_lb_to_config
   tasks:
   - set_fact:
-      openshift_upgrade_target: '3.9'
+      openshift_upgrade_target: '3.8'
       openshift_upgrade_min: '3.7'
+      openshift_release: '3.8'
+      _requested_pkg_version: "{{openshift_pkg_version if openshift_pkg_version is defined else omit }}"
+      _requested_image_tag: "{{openshift_image_tag if openshift_image_tag is defined else omit }}"
+    when: hostvars[groups.oo_first_master.0].openshift_currently_installed_version | version_compare('3.8','<')
 
 - import_playbook: ../pre/config.yml
   # These vars a meant to exclude oo_nodes from plays that would otherwise include
@@ -35,19 +41,57 @@
     l_upgrade_verify_targets_hosts: "oo_masters_to_config"
     l_upgrade_docker_target_hosts: "oo_masters_to_config:oo_etcd_to_config"
     l_upgrade_excluder_hosts: "oo_masters_to_config"
+  when: hostvars[groups.oo_first_master.0].openshift_currently_installed_version | version_compare('3.8','<')
 
-- import_playbook: validator.yml
-
-- name: Flag pre-upgrade checks complete for hosts without errors
+- name: Flag pre-upgrade checks complete for hosts without errors 3.8
   hosts: oo_masters_to_config:oo_etcd_to_config
   tasks:
   - set_fact:
       pre_upgrade_complete: True
+    when: hostvars[groups.oo_first_master.0].openshift_currently_installed_version | version_compare('3.8','<')
 
 # Pre-upgrade completed
 
+- import_playbook: ../upgrade_control_plane.yml
+  vars:
+    openshift_release: '3.8'
+  when: hostvars[groups.oo_first_master.0].openshift_currently_installed_version | version_compare('3.8','<')
+
+## 3.8 upgrade complete we should now be able to upgrade to 3.9
+
+- name: Configure the upgrade target for the common upgrade tasks 3.9
+  hosts: oo_masters_to_config:oo_etcd_to_config:oo_lb_to_config
+  tasks:
+  - meta: clear_facts
+  - set_fact:
+      openshift_upgrade_target: '3.9'
+      openshift_upgrade_min: '3.8'
+      openshift_release: '3.9'
+      openshift_pkg_version: "{{ _requested_pkg_version | default ('-3.9*') }}"
+      openshift_image_tag: "{{ _requested_image_tag | default('v3.9') }}"
+
+- import_playbook: ../pre/config.yml
+  # These vars a meant to exclude oo_nodes from plays that would otherwise include
+  # them by default.
+  vars:
+    l_openshift_version_set_hosts: "oo_etcd_to_config:oo_masters_to_config:!oo_first_master"
+    l_openshift_version_check_hosts: "oo_masters_to_config:!oo_first_master"
+    l_upgrade_repo_hosts: "oo_masters_to_config:oo_etcd_to_config:oo_lb_to_config"
+    l_upgrade_no_proxy_hosts: "oo_masters_to_config"
+    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"
+    l_upgrade_docker_target_hosts: "oo_masters_to_config:oo_etcd_to_config"
+    l_upgrade_excluder_hosts: "oo_masters_to_config"
+
+- name: Flag pre-upgrade checks complete for hosts without errors
+  hosts: oo_masters_to_config:oo_etcd_to_config
+  tasks:
+  - set_fact:
+      pre_upgrade_complete: True
 
 - import_playbook: ../upgrade_control_plane.yml
+  vars:
+    openshift_release: '3.9'
 
 # All controllers must be stopped at the same time then restarted
 - name: Cycle all controller services to force new leader election mode

+ 1 - 0
playbooks/common/openshift-cluster/upgrades/v3_9/upgrade_nodes.yml

@@ -12,6 +12,7 @@
   - set_fact:
       openshift_upgrade_target: '3.9'
       openshift_upgrade_min: '3.7'
+      openshift_release: '3.9'
 
 - import_playbook: ../pre/config.yml
   vars:

+ 1 - 1
playbooks/common/openshift-cluster/upgrades/v3_9/validator.yml

@@ -1,5 +1,5 @@
 ---
-- name: Verify 3.9 specific upgrade checks
+- name: Verify 3.8 specific upgrade checks
   hosts: oo_first_master
   roles:
   - { role: lib_openshift }

+ 0 - 1
roles/openshift_master/tasks/upgrade/rpm_upgrade.yml

@@ -34,7 +34,6 @@
       - "{{ openshift_service_type }}-node{{ openshift_pkg_version }}"
       - "{{ openshift_service_type }}-sdn-ovs{{ openshift_pkg_version }}"
       - "{{ openshift_service_type }}-clients{{ openshift_pkg_version }}"
-      - "tuned-profiles-{{ openshift_service_type }}-node{{ openshift_pkg_version }}"
   register: result
   until: result is succeeded
   when: ansible_pkg_mgr == 'dnf'

+ 3 - 2
roles/openshift_version/tasks/first_master_containerized_version.yml

@@ -7,6 +7,7 @@
   when:
   - openshift_image_tag is defined
   - openshift_version is not defined
+  - not (openshift_version_reinit | default(false))
 
 - name: Set containerized version to configure if openshift_release specified
   set_fact:
@@ -20,7 +21,7 @@
     docker run --rm {{ openshift_cli_image }}:latest version
   register: cli_image_version
   when:
-  - openshift_version is not defined
+  - openshift_version is not defined or openshift_version_reinit | default(false)
   - not openshift_use_crio_only
 
 # Origin latest = pre-release version (i.e. v1.3.0-alpha.1-321-gb095e3a)
@@ -34,7 +35,7 @@
 
 - set_fact:
     openshift_version: "{{ cli_image_version.stdout_lines[0].split(' ')[1].split('-')[0][1:] }}"
-  when: openshift_version is not defined
+  when: openshift_version is not defined or openshift_version_reinit | default(false)
 
 # If we got an openshift_version like "3.2", lookup the latest 3.2 container version
 # and use that value instead.

+ 5 - 1
roles/openshift_version/tasks/first_master_rpm_version.yml

@@ -6,6 +6,7 @@
   when:
   - openshift_pkg_version is defined
   - openshift_version is not defined
+  - not (openshift_version_reinit | default(false))
 
 # These tasks should only be run against masters and nodes
 - name: Set openshift_version for rpm installation
@@ -13,4 +14,7 @@
 
 - set_fact:
     openshift_version: "{{ rpm_results.results.versions.available_versions.0 }}"
-  when: openshift_version is not defined
+  when: openshift_version is not defined or ( openshift_version_reinit | default(false) )
+- set_fact:
+    openshift_pkg_version: "-{{ rpm_results.results.versions.available_versions.0 }}"
+  when: openshift_version_reinit | default(false)

+ 5 - 2
roles/openshift_version/tasks/masters_and_nodes.yml

@@ -6,9 +6,12 @@
     include_tasks: check_available_rpms.yml
   - name: Fail if rpm version and docker image version are different
     fail:
-      msg: "OCP rpm version {{ openshift_rpm_version }} is different from OCP image version {{ openshift_version }}"
+      msg: "OCP rpm version {{ rpm_results.results.versions.available_versions.0 }} is different from OCP image version {{ openshift_version }}"
     # Both versions have the same string representation
-    when: rpm_results.results.versions.available_versions.0 != openshift_version
+    when:
+    - openshift_version not in rpm_results.results.versions.available_versions.0
+    - openshift_version_reinit | default(false)
+
   # block when
   when: not openshift_is_atomic | bool