Skip to content

Commit

Permalink
Merge pull request #779 from IBM/sequential-install
Browse files Browse the repository at this point in the history
#765 Always use apply-cr to apply services, remove sequential_install
  • Loading branch information
fketelaars authored Sep 16, 2024
2 parents 3c20551 + d91de5a commit cd4b308
Show file tree
Hide file tree
Showing 18 changed files with 477 additions and 221 deletions.
Original file line number Diff line number Diff line change
@@ -1,21 +1,4 @@
---
- name: Install cartridges for CP4D cluster {{ _p_current_cp4d_cluster.project }} using OLM utils
debug:
msg: ""

- set_fact:
_apply_cr_cartridges: >-
{{ _cartridges_to_install |
rejectattr('olm_utils_name','==','scheduler') |
selectattr('separate_install','undefined') |
union(_cartridges_to_install | selectattr('separate_install','defined') | selectattr('separate_install','!=',True)) }}
- set_fact:
_apply_cr_cartridges_list: >-
{{ _apply_cr_cartridges |
map(attribute='olm_utils_name') |
join(',')}}
- name: Run pre-processing scripts
include_tasks: cp4d-install-cr-pre-processing.yml
loop: "{{ _apply_cr_cartridges | default([]) }}"
Expand Down Expand Up @@ -51,40 +34,32 @@
regexp: 'kind:\s+dashboardservice'
replace: 'kind: DashboardService'

- name: Run apply-cr command to install cartridges
block:
- name: Generate apply-cr command to install cartridges
set_fact:
_apply_cr_command: "{{ lookup('template', 'apply-cr-cartridges.j2') }}"
vars:
_p_preview_script: False

- name: Show apply-cr command for install cartridges
debug:
var: _apply_cr_command
- name: Generate apply-cr command to install cartridges
set_fact:
_apply_cr_command: "{{ lookup('template', 'apply-cr-cartridges.j2') }}"
vars:
_p_preview_script: False

- name: Run apply-cr command to install cartridges, logs are in {{ status_dir }}/log/{{ _p_current_cp4d_cluster.project }}-apply-cr-cartridges.log
shell: |
{{ _apply_cr_command }} > {{ status_dir }}/log/{{ _p_current_cp4d_cluster.project }}-apply-cr-cartridges.log 2>&1
register: _install_cartridges_result
failed_when: False
- name: Show apply-cr command for install cartridges
debug:
var: _apply_cr_command

- name: Fail if there was an error installing the cartridge(s) using apply-cr
fail:
msg: "{{ _install_cartridges_result }}"
when:
- _install_cartridges_result.rc!=0
- not (cpd_test_cartridges | default(False) | bool)
- name: Run apply-cr command to install cartridges, logs are in {{ status_dir }}/log/{{ _p_current_cp4d_cluster.project }}-apply-cr-cartridges.log
shell: |
{{ _apply_cr_command }} > {{ status_dir }}/log/{{ _p_current_cp4d_cluster.project }}-apply-cr-cartridges.log 2>&1
register: _install_cartridges_result
failed_when: False

- set_fact:
_cp4d_cartridges_installed_successfully: False
when: _install_cartridges_result.rc!=0
when: _sequential_install
- name: Fail if there was an error installing the cartridge(s) using apply-cr
fail:
msg: "{{ _install_cartridges_result }}"
when:
- _install_cartridges_result.rc!=0
- not (cpd_test_cartridges | default(False) | bool)

- name: Run shell script to install cartridges, logs are in {{ status_dir }}/log/{{ _p_current_cp4d_cluster.project }}-apply-cr-cartridges.log
shell: |
{{ status_dir }}/cp4d/{{ _p_current_cp4d_cluster.project }}-apply-cr-cartridges.sh >> {{ status_dir }}/log/{{ _p_current_cp4d_cluster.project }}-apply-cr-cartridges.log 2>&1
when: not _sequential_install
- set_fact:
_cp4d_cartridges_installed_successfully: False
when: _install_cartridges_result.rc!=0

- name: Wait for cartridges to finish installation
include_tasks: cp4d-wait-cartridges-ready.yml
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,30 +25,25 @@
remote_src: True
mode: u+rwx

- name: Run apply-cr command to install cartridge {{ _current_cp4d_cartridge.olm_utils_name }}
block:
- name: Generate apply-cr command to install cartridge {{ _current_cp4d_cartridge.olm_utils_name }}
set_fact:
_apply_cr_command: "{{ lookup('template', 'apply-cr-dp.j2') }}"
vars:
_p_preview_script: False
- name: Run apply-cr command to install cartridge {{ _current_cp4d_cartridge.olm_utils_name }}, logs are in {{ status_dir }}/log/{{ _p_current_cp4d_cluster.project }}-{{ _current_cp4d_cartridge.olm_utils_name }}-apply-cr.log
shell: |
{{ _apply_cr_command }} >> {{ status_dir }}/log/{{ _p_current_cp4d_cluster.project }}-{{ _current_cp4d_cartridge.olm_utils_name }}-apply-cr.log 2>&1
register: _install_cartridges_result
failed_when: False
- name: Fail if there was an error installing the cartridge {{ _current_cp4d_cartridge.olm_utils_name }} using apply-cr
fail:
msg: "{{ _install_cartridges_result }}"
when:
- _install_cartridges_result.rc!=0
- not (cpd_test_cartridges | default(False) | bool)
- set_fact:
_cp4d_cartridges_installed_successfully: False
when: _install_cartridges_result.rc!=0
when: _sequential_install

- name: Run shell script to install cartridge {{ _current_cp4d_cartridge.olm_utils_name }}, logs are in {{ status_dir }}/log/{{ _p_current_cp4d_cluster.project }}-{{ _current_cp4d_cartridge.olm_utils_name }}-apply-cr.log
- name: Generate apply-cr command to install cartridge {{ _current_cp4d_cartridge.olm_utils_name }}
set_fact:
_apply_cr_command: "{{ lookup('template', 'apply-cr-dp.j2') }}"
vars:
_p_preview_script: False

- name: Run apply-cr command to install cartridge {{ _current_cp4d_cartridge.olm_utils_name }}, logs are in {{ status_dir }}/log/{{ _p_current_cp4d_cluster.project }}-{{ _current_cp4d_cartridge.olm_utils_name }}-apply-cr.log
shell: |
{{ status_dir }}/cp4d/{{ _p_current_cp4d_cluster.project }}-apply-cr-dp.sh >> {{ status_dir }}/log/{{ _p_current_cp4d_cluster.project }}-{{ _current_cp4d_cartridge.olm_utils_name }}-apply-cr.log 2>&1
when: not _sequential_install
{{ _apply_cr_command }} >> {{ status_dir }}/log/{{ _p_current_cp4d_cluster.project }}-{{ _current_cp4d_cartridge.olm_utils_name }}-apply-cr.log 2>&1
register: _install_cartridges_result
failed_when: False

- name: Fail if there was an error installing the cartridge {{ _current_cp4d_cartridge.olm_utils_name }} using apply-cr
fail:
msg: "{{ _install_cartridges_result }}"
when:
- _install_cartridges_result.rc!=0
- not (cpd_test_cartridges | default(False) | bool)

- set_fact:
_cp4d_cartridges_installed_successfully: False
when: _install_cartridges_result.rc!=0
Original file line number Diff line number Diff line change
Expand Up @@ -30,33 +30,25 @@
remote_src: True
mode: u+rwx

- name: Run apply-cr command to install cartridge {{ _current_cp4d_cartridge.olm_utils_name }}
block:
- name: Generate apply-cr command to install cartridge {{ _current_cp4d_cartridge.olm_utils_name }}
set_fact:
_apply_cr_command: "{{ lookup('template', 'apply-cr-separate.j2') }}"
vars:
_p_preview_script: False

- name: Run apply-cr command to install cartridge {{ _current_cp4d_cartridge.olm_utils_name }}, logs are in {{ status_dir }}/log/{{ _p_current_cp4d_cluster.project }}-{{ _current_cp4d_cartridge.olm_utils_name }}-apply-cr.log
shell: |
{{ _apply_cr_command }} >> {{ status_dir }}/log/{{ _p_current_cp4d_cluster.project }}-{{ _current_cp4d_cartridge.olm_utils_name }}-apply-cr.log 2>&1
register: _install_cartridges_result
failed_when: False

- name: Fail if there was an error installing the cartridge {{ _current_cp4d_cartridge.olm_utils_name }} using apply-cr
fail:
msg: "{{ _install_cartridges_result }}"
when:
- _install_cartridges_result.rc!=0
- not (cpd_test_cartridges | default(False) | bool)

- set_fact:
_cp4d_cartridges_installed_successfully: False
when: _install_cartridges_result.rc!=0
when: _sequential_install

- name: Run shell script to install cartridge {{ _current_cp4d_cartridge.olm_utils_name }}, logs are in {{ status_dir }}/log/{{ _p_current_cp4d_cluster.project }}-{{ _current_cp4d_cartridge.olm_utils_name }}-apply-cr.log
- name: Generate apply-cr command to install cartridge {{ _current_cp4d_cartridge.olm_utils_name }}
set_fact:
_apply_cr_command: "{{ lookup('template', 'apply-cr-separate.j2') }}"
vars:
_p_preview_script: False

- name: Run apply-cr command to install cartridge {{ _current_cp4d_cartridge.olm_utils_name }}, logs are in {{ status_dir }}/log/{{ _p_current_cp4d_cluster.project }}-{{ _current_cp4d_cartridge.olm_utils_name }}-apply-cr.log
shell: |
{{ status_dir }}/cp4d/{{ _p_current_cp4d_cluster.project }}-apply-cr-{{ _current_cp4d_cartridge.olm_utils_name }}.sh >> {{ status_dir }}/log/{{ _p_current_cp4d_cluster.project }}-{{ _current_cp4d_cartridge.olm_utils_name }}-apply-cr.log 2>&1
when: not _sequential_install
{{ _apply_cr_command }} >> {{ status_dir }}/log/{{ _p_current_cp4d_cluster.project }}-{{ _current_cp4d_cartridge.olm_utils_name }}-apply-cr.log 2>&1
register: _install_cartridges_result
failed_when: False

- name: Fail if there was an error installing the cartridge {{ _current_cp4d_cartridge.olm_utils_name }} using apply-cr
fail:
msg: "{{ _install_cartridges_result }}"
when:
- _install_cartridges_result.rc!=0
- not (cpd_test_cartridges | default(False) | bool)

- set_fact:
_cp4d_cartridges_installed_successfully: False
when: _install_cartridges_result.rc!=0
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,6 @@
state: present
create: True

- name: Insert cpd_platform options into {{ status_dir }}/cp4d/{{ _p_current_cp4d_cluster.project }}-install-options.yml
blockinfile:
path: "{{ status_dir }}/cp4d/{{ _p_current_cp4d_cluster.project }}-install-options.yml"
marker: "# {mark} CPD Platform options #"
block: |2
cpd_platform:
cloudpakfordata: true
iamIntegration: {{ _p_current_cp4d_cluster.use_fs_iam | default(False) | bool }}
- name: Starting background task to patch Db2U clusters. Logs are in {{ status_dir }}/log/{{ _p_current_cp4d_cluster.project }}-db2u-temp-patch.log
shell: |
{{ role_path }}/files/temp-patch-db2u.sh \
Expand All @@ -36,7 +27,23 @@
- set_fact:
_cp4d_cartridges_installed_successfully: True

- set_fact:
_apply_cr_cartridges: >-
{{ _cartridges_to_install |
rejectattr('olm_utils_name','==','scheduler') |
rejectattr('olm_utils_name','==','cpd_platform') |
rejectattr('olm_utils_name','==','cpfs') |
selectattr('separate_install','undefined') |
union(_cartridges_to_install | selectattr('separate_install','defined') | selectattr('separate_install','!=',True)) }}
- set_fact:
_apply_cr_cartridges_list: >-
{{ _apply_cr_cartridges |
map(attribute='olm_utils_name') |
join(',')}}
- include_tasks: cp4d-install-cartridges-olm-utils.yml
when: _apply_cr_cartridges != []

- name: Install separate cartridges
include_tasks: cp4d-install-separate-cr.yml
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,22 +37,15 @@
remote_src: True
mode: u+rwx

- name: Run apply-cr command to install Cloud Pak for Data platform
block:
- name: Generate apply-cr command to install Cloud Pak for Data platform
set_fact:
_apply_cr_command: "{{ lookup('template', 'apply-cr-cpd-platform.j2') }}"
vars:
_p_preview_script: False
- name: Run apply-cr command to install Cloud Pak for Data platform, logs are in {{ status_dir }}/log/{{ current_cp4d_cluster.project }}-apply-cr-cpd-platform.log
shell: |
{{ _apply_cr_command }} > {{ status_dir }}/log/{{ current_cp4d_cluster.project }}-apply-cr-cpd-platform.log 2>&1
when: _sequential_install
- name: Generate apply-cr command to install Cloud Pak for Data platform
set_fact:
_apply_cr_command: "{{ lookup('template', 'apply-cr-cpd-platform.j2') }}"
vars:
_p_preview_script: False

- name: Run shell script to install Cloud Pak for Data platform, logs are in {{ status_dir }}/log/{{ current_cp4d_cluster.project }}-apply-cr-cpd-platform.log
- name: Run apply-cr command to install Cloud Pak for Data platform, logs are in {{ status_dir }}/log/{{ current_cp4d_cluster.project }}-apply-cr-cpd-platform.log
shell: |
{{ status_dir }}/cp4d/{{ current_cp4d_cluster.project }}-apply-cr-platform.sh >> {{ status_dir }}/log/{{ current_cp4d_cluster.project }}-apply-cr-cpd-platform.log 2>&1
when: not _sequential_install
{{ _apply_cr_command }} > {{ status_dir }}/log/{{ current_cp4d_cluster.project }}-apply-cr-cpd-platform.log 2>&1
# Wait for ZenService to be created (can take 10-15 minutes)
- name: Wait for ZenService to be completed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@
_p_current_cp4d_cluster: "{{ current_cp4d_cluster }}"

- include_tasks: install-control-plane-olm-utils.yml
when:
- not _upgrade_cp4d

- name: Add Cloud Pak for Data route to /etc/hosts for vSphere
include_tasks: vsphere-configure-etc-hosts.yml
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ apply-cr \
--release={{ current_cp4d_cluster.cp4d_version }} \
--license_acceptance={{ _cpd_accept_licenses | default(False) | string | lower }} \
--preview={%- if _p_preview_script -%}true{%- else -%}false{%- endif %} \
--upgrade={{ _upgrade_cp4d | default(False) | string | lower }} \
-v \
--cpd_instance_ns={{ current_cp4d_cluster.project }} \
--components=cpfs,cpd_platform \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,24 +146,6 @@
- _installed_ibmcpd_version < "4.6.5"
- not allow_cp4d_upgrade | default(False) | bool

# Determine if cartridges must be installed sequentially
- set_fact:
_sequential_install: "{{ _p_current_cp4d_cluster.sequential_install | default(True) | bool }}"

- name: Force sequential install if CP4D must be upgraded
set_fact:
_sequential_install: "{{ _sequential_install or _upgrade_cp4d }}"

- name: Determine if CP4D services must be installed sequentially
set_fact:
_sequential_install: "{{ _sequential_install or item.force_sequential_install }}"
loop: "{{ _cartridges_to_install }}"
no_log: True

- name: Show if sequential install is done
debug:
var: _sequential_install

# check if any of the cartridges have a db2u dependency
- include_tasks: check-db2u-dependency.yml

Expand Down
Loading

0 comments on commit cd4b308

Please sign in to comment.