From cddd48f388aba2c35c604666dd8c8f746e06b25a Mon Sep 17 00:00:00 2001 From: sabrina-yee <75322195+sabrina-yee@users.noreply.github.com> Date: Thu, 8 Sep 2022 12:10:25 -0400 Subject: [PATCH] sept-2022-docs202 (#213) --- documentation/VARIABLES.md | 2 +- roles/hcl/connections-wizards/vars/main.yml | 2 +- .../docs/setup-environment/tasks/setup_os.yml | 4 +- roles/hcl/docs/tasks/check_vars.yml | 92 +++++++++++++++++++ roles/hcl/docs/tasks/cleanup_env.yml | 7 +- roles/hcl/docs/tasks/download_docs.yml | 24 +++-- .../docs/tasks/install_docs_conversion.yml | 47 +++++++--- .../install_docs_conversion_sec_node.yml | 45 ++++++--- roles/hcl/docs/tasks/install_docs_editor.yml | 49 +++++++--- .../docs/tasks/install_docs_editor_ext.yml | 44 ++++++--- .../docs/tasks/install_docs_editor_proxy.yml | 42 ++++++--- .../tasks/install_docs_editor_sec_node.yml | 49 ++++++---- roles/hcl/docs/tasks/install_docs_viewer.yml | 54 +++++++---- .../docs/tasks/install_docs_viewer_ext.yml | 44 ++++++--- roles/hcl/docs/tasks/main.yml | 7 +- roles/hcl/docs/tasks/version_check.yml | 55 +++++++++++ roles/hcl/docs/vars/main.yml | 11 ++- 17 files changed, 446 insertions(+), 132 deletions(-) create mode 100644 roles/hcl/docs/tasks/version_check.yml diff --git a/documentation/VARIABLES.md b/documentation/VARIABLES.md index c72279c4..42ef11ca 100644 --- a/documentation/VARIABLES.md +++ b/documentation/VARIABLES.md @@ -242,7 +242,7 @@ restrict_reader_access__trusted_realms | *none* - optional | true will set appli Name | Default | Description ---- | --------| ------------- cnx_docs_download_location | *none* - required | Connections Docs kit download location -cnx_docs_package_name | IBMConnectionsDocs_2.0.1.zip | Connections Docs install kit file +cnx_docs_package_name | HCL_Docs_v202.zip | Connections Docs install kit file hcl_program_folder | /opt/HCL | Location to store Docs program folders conversion_install_folder | DocsConversion | Conversion program folder name editor_install_folder | DocsEditor | Editor program folder name diff --git a/roles/hcl/connections-wizards/vars/main.yml b/roles/hcl/connections-wizards/vars/main.yml index d73de37f..b3d62ee8 100644 --- a/roles/hcl/connections-wizards/vars/main.yml +++ b/roles/hcl/connections-wizards/vars/main.yml @@ -14,7 +14,7 @@ __db_extraction_folder: "{{ db_extraction_folder | default('/opt/HCL/DB2 __installation_folder: "{{ __db_extraction_folder }}/Wizards" __docs_download_location: "{{ cnx_docs_download_location | default('http://c7lb1.cnx.cwp.pnp-hcl.com:8001/Docs') }}" -__docs_package_name: "{{ cnx_docs_package_name | default('IBMConnectionsDocs_2.0.1.zip') }}" +__docs_package_name: "{{ cnx_docs_package_name | default('HCL_Docs_v202.zip') }}" __docs_extraction_folder: "{{ docs_extraction_folder | default('/opt/HCL/InstallBinaries/Docs') }}" __docs_installation_folder: "{{ __docs_extraction_folder }}/SetupDB" diff --git a/roles/hcl/docs/setup-environment/tasks/setup_os.yml b/roles/hcl/docs/setup-environment/tasks/setup_os.yml index 21342fd6..01ff0a74 100644 --- a/roles/hcl/docs/setup-environment/tasks/setup_os.yml +++ b/roles/hcl/docs/setup-environment/tasks/setup_os.yml @@ -6,7 +6,7 @@ - ansible_os_family == "RedHat" - ansible_distribution_major_version == "7" -- name: Install epel-release on RHEL 8 +- name: Install epel-release on RHEL 8 / AlmaLinux yum: name: https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm state: present @@ -15,7 +15,7 @@ - ansible_os_family == "RedHat" - ansible_distribution_major_version == "8" -- name: Install pre-requisites Yum on RHEL 8 +- name: Install pre-requisites Yum on RHEL 8 / AlmaLinux yum: name: ['nfs-utils', 'gtk2', 'libXtst', 'xorg-x11-fonts-Type1', 'psmisc', 'glibc.i686', 'gtk2.i686', 'libXtst.i686', 'libXft.i686', 'unzip', 'vim', 'python3-pip', 'python3-passlib.noarch'] state: present diff --git a/roles/hcl/docs/tasks/check_vars.yml b/roles/hcl/docs/tasks/check_vars.yml index 17b16c8a..7f017a36 100644 --- a/roles/hcl/docs/tasks/check_vars.yml +++ b/roles/hcl/docs/tasks/check_vars.yml @@ -64,3 +64,95 @@ that: - docs_url|length > 0 msg: "Set the value of 'docs_url' in the inventory file." + +# Check Docs install status +- name: Check if Docs Conversion has been installed + include_tasks: + file: version_check.yml + vars: + name: "Docs Conversion" + success_file: "{{ __conversion_install_success_file }}" + program_path: "{{ __docs_conversion_install_location }}" + product_file_path: "product/properties/version" + product_file_pattern: "*.swidtag" + version_string_path: "{{ __docs_conversion_install_location }}/product/installer/version.txt" + component_var: "conversion" + already_installed_var: "conversion_already_installed" + upgrade_var: "conversion_upgrade" + when: inventory_hostname in groups["conversion_servers"] + +# use product/installer/version.txt in each node to determine installed version for that node +- name: Check if Docs Editor has been installed + include_tasks: + file: version_check.yml + vars: + name: "Docs Editor" + success_file: "{{ __editor_install_success_file }}" + program_path: "{{ __docs_editor_install_location }}" + product_file_path: "product/properties/version" + product_file_pattern: "*.swidtag" + version_string_path: "{{ __docs_editor_install_location }}/product/installer/version.txt" + component_var: "editor" + already_installed_var: "editor_already_installed" + upgrade_var: "editor_upgrade" + when: inventory_hostname in groups["docs_servers"] + +- name: Check if Docs Viewer has been installed + include_tasks: + file: version_check.yml + vars: + name: "Docs Viewer" + success_file: "{{ __viewer_install_success_file }}" + program_path: "{{ __docs_viewer_install_location }}" + product_file_path: "product" + product_file_pattern: "*.ear" + version_string_path: "{{ __docs_viewer_install_location }}/product/installer/version.txt" + component_var: "viewer" + already_installed_var: "viewer_already_installed" + upgrade_var: "viewer_upgrade" + when: inventory_hostname in groups["viewer_servers"][0] + +- name: Check if Docs Editor Proxy has been installed + include_tasks: + file: version_check.yml + vars: + name: "Docs Editor Proxy" + success_file: "{{ __editor_proxy_install_success_file }}" + program_path: "{{ __docs_editor_install_location }}/proxy" + product_file_path: "product" + product_file_pattern: "*.jar" + version_string_path: "{{ __docs_editor_install_location }}/proxy/product/installer/version.txt" + component_var: "editor_proxy" + already_installed_var: "editor_proxy_already_installed" + upgrade_var: "editor_proxy_upgrade" + when: inventory_hostname in groups["proxy_servers"][0] + +- name: Check if Docs Editor Extension has been installed + include_tasks: + file: version_check.yml + vars: + name: "Docs Editor Extension" + success_file: "{{ __docs_editor_ext_install_success_file }}" + program_path: "{{ __docs_editor_ext_install_location }}" + product_file_path: "product" + product_file_pattern: "*.jar" + version_string_path: "{{ __docs_editor_ext_install_location }}/product/installer/version.txt" + component_var: "docs_ext" + already_installed_var: "docs_ext_already_installed" + upgrade_var: "docs_ext_upgrade" + when: inventory_hostname in groups["cnx_was_servers"][0] + +- name: Check if Docs Viewer Extension has been installed + include_tasks: + file: version_check.yml + vars: + name: "Docs Viewer Extension" + success_file: "{{ __docs_viewer_ext_install_success_file }}" + program_path: "{{ __docs_viewer_ext_install_location }}" + product_file_path: "product" + product_file_pattern: "*.jar" + version_string_path: "{{ __docs_viewer_ext_install_location }}/product/installer/version.txt" + component_var: "viewer_ext" + already_installed_var: "viewer_ext_already_installed" + upgrade_var: "viewer_ext_upgrade" + when: inventory_hostname in groups["cnx_was_servers"][0] diff --git a/roles/hcl/docs/tasks/cleanup_env.yml b/roles/hcl/docs/tasks/cleanup_env.yml index bc3e5aaf..4396d318 100644 --- a/roles/hcl/docs/tasks/cleanup_env.yml +++ b/roles/hcl/docs/tasks/cleanup_env.yml @@ -4,11 +4,13 @@ state: absent path: "{{ __extraction_folder }}" +# Docs 2.0.1 install scripts require python2 - name: Verify if python default was changed on RHEL 8 stat: path: "{{ __hcl_program_folder }}/python2_alternatives_set.success" register: python2_default_was_set when: + - __docs_install_version is version('2.0.2', '<') - ansible_os_family == "RedHat" - ansible_distribution_major_version == "8" @@ -17,6 +19,7 @@ become: true register: python2_alternatives_unset when: + - __docs_install_version is version('2.0.2', '<') - ansible_os_family == "RedHat" - ansible_distribution_major_version == "8" - python2_default_was_set.stat.exists @@ -25,4 +28,6 @@ file: path: "{{ __hcl_program_folder }}/python2_alternatives_set.success" state: absent - when: python2_alternatives_unset is changed + when: + - __docs_install_version is version('2.0.2', '<') + - python2_alternatives_unset is changed diff --git a/roles/hcl/docs/tasks/download_docs.yml b/roles/hcl/docs/tasks/download_docs.yml index c8b20866..326030cc 100644 --- a/roles/hcl/docs/tasks/download_docs.yml +++ b/roles/hcl/docs/tasks/download_docs.yml @@ -65,40 +65,48 @@ __zip_prefix: ViewerLCCustomizeApp when: inventory_hostname in groups["cnx_was_servers"] -# Docs install scripts require python2 -- name: Check whether python2 is installed on RHEL 8 +# Docs 2.0.1 install scripts require python2 +- name: Check whether python2 is installed on RHEL 8 (for v2.0.1) command: python2 --version register: python_installed ignore_errors: true when: + - __docs_install_version is version('2.0.2', '<') - ansible_os_family == "RedHat" - ansible_distribution_major_version == "8" -- name: Install python2 on RHEL 8 +- name: Install python2 on RHEL 8 (for v2.0.1) yum: name: ['python2'] state: present when: + - __docs_install_version is version('2.0.2', '<') - ansible_os_family == "RedHat" - ansible_distribution_major_version == "8" - python_installed.failed -- name: Get default python version on RHEL 8 +- name: Get default python version on RHEL 8 (for v2.0.1) command: python --version register: python_default_version ignore_errors: true when: + - __docs_install_version is version('2.0.2', '<') - ansible_os_family == "RedHat" - ansible_distribution_major_version == "8" -- name: Print current default python version on RHEL 8 +- name: Print current default python version on RHEL 8 (for v2.0.1) debug: var=python_default_version + when: + - __docs_install_version is version('2.0.2', '<') + - ansible_os_family == "RedHat" + - ansible_distribution_major_version == "8" -- name: Set python2 as default for RHEL 8 +- name: Set python2 as default for RHEL 8 (for v2.0.1) command: alternatives --set python /usr/bin/python2 become: true register: python2_alternatives_set when: + - __docs_install_version is version('2.0.2', '<') - ansible_os_family == "RedHat" - ansible_distribution_major_version == "8" - (python_default_version is defined) and (python_default_version is not search("Python 2")) @@ -107,4 +115,6 @@ file: path: "{{ __hcl_program_folder }}/python2_alternatives_set.success" state: touch - when: python2_alternatives_set is changed + when: + - __docs_install_version is version('2.0.2', '<') + - python2_alternatives_set is changed diff --git a/roles/hcl/docs/tasks/install_docs_conversion.yml b/roles/hcl/docs/tasks/install_docs_conversion.yml index e14aed9a..ae0d7b6b 100644 --- a/roles/hcl/docs/tasks/install_docs_conversion.yml +++ b/roles/hcl/docs/tasks/install_docs_conversion.yml @@ -1,8 +1,10 @@ -- name: Verify if Docs Conversion is already installed - stat: - path: "{{ __conversion_install_success_file }}" - register: conversion_already_installed +- name: Is Docs Conversion already installed? + debug: var=conversion_already_installed +- name: Is this a Docs Conversion upgrade? + debug: var=conversion_upgrade + +# upgrade actually uses the cfg file in the program folder but updating it anyway in case we need it - name: Edit cfg.properties replace: path: "{{ __conversion_cfg_prop_location }}/cfg.properties" @@ -23,7 +25,7 @@ - { prop_name: "was_install_root", prop_value: "{{ __was_install_root_r }}" } - { prop_name: "non_job_mgr_mode", prop_value: "{{ __non_job_mgr_mode_r }}" } - { prop_name: "viewer_url", prop_value: "{{ __viewer_url_r }}" } - when: not conversion_already_installed.stat.exists + when: not conversion_already_installed|bool or conversion_upgrade|bool # need to copy cfg to cfg.node before install per documentation - name: Copy cfg.properties to cfg.node.properties @@ -31,26 +33,43 @@ src: "{{ __conversion_cfg_prop_location }}/cfg.properties" dest: "{{ __conversion_cfg_prop_location }}/cfg.node.properties" remote_src: yes - when: not conversion_already_installed.stat.exists + when: not conversion_already_installed|bool or conversion_upgrade|bool -- name: Run the Docs Conversion installer +- name: Run the Docs Conversion installer (fresh) shell: chdir: "{{ __extraction_folder }}/{{ __conversion_install_folder }}/installer" cmd: "./install.sh -wasadminID {{ was_username }} -wasadminPW {{ was_password }} -mapWebserver true -acceptLicense -silentlyInstall" become: true when: - - not conversion_already_installed.stat.exists - register: sec_install_performed + - not conversion_already_installed|bool + register: install_performed + +- name: Run the Docs Conversion installer (upgrade) + shell: + chdir: "{{ __extraction_folder }}/{{ __conversion_install_folder }}/installer" + cmd: "./upgrade.sh -wasadminID {{ was_username }} -wasadminPW {{ was_password }} -acceptLicense -silentlyInstall -installRoot {{ __docs_conversion_install_location }}" + become: true + when: + - conversion_upgrade|bool + register: upgrade_performed -- name: Search for success message in install log +- name: Search for success message in install log (fresh) become: yes shell: "grep -i '{{ __install_success_message }}' {{ __docs_conversion_install_location }}/logs/conversion_install.log" - register: conversion_success_message_found - failed_when: conversion_success_message_found.stdout|length == 0 - when: sec_install_performed is not skipped + register: conversion_install_success_message_found + failed_when: conversion_install_success_message_found.stdout|length == 0 + when: install_performed is not skipped + +- name: Search for success message in install log (upgrade) + become: yes + shell: "grep -i '{{ __upgrade_success_message }}' {{ __docs_conversion_install_location }}/logs/conversion_upgrade.log" + register: conversion_upgrade_success_message_found + failed_when: conversion_upgrade_success_message_found.stdout|length == 0 + when: upgrade_performed is not skipped - name: "Create {{ __conversion_install_success_file }} file" file: path: "{{ __conversion_install_success_file }}" state: touch - when: sec_install_performed is not skipped and conversion_success_message_found.stdout|length > 0 + when: install_performed is not skipped and conversion_install_success_message_found.stdout|length > 0 or + upgrade_performed is not skipped and conversion_upgrade_success_message_found.stdout|length > 0 diff --git a/roles/hcl/docs/tasks/install_docs_conversion_sec_node.yml b/roles/hcl/docs/tasks/install_docs_conversion_sec_node.yml index 82fe53ae..04ed11f4 100644 --- a/roles/hcl/docs/tasks/install_docs_conversion_sec_node.yml +++ b/roles/hcl/docs/tasks/install_docs_conversion_sec_node.yml @@ -5,18 +5,17 @@ register: conversion_first_already_installed delegate_to: "{{ groups['conversion_servers'][0] }}" -- name: Verify if Docs Conversion is already installed on subsequent node - stat: - path: "{{ __conversion_install_success_file }}" - register: conversion_current_node_already_installed - - debug: var=conversion_first_already_installed.stat.exists run_once: true -- debug: var=conversion_current_node_already_installed.stat.exists - run_once: true +- name: Is Docs Conversion already installed on this subsequent node? + debug: var=conversion_already_installed + +- name: Is this a Docs Conversion upgrade? + debug: var=conversion_upgrade # cfg.properties and cfg.node.properties content are the same so omit copying unlike install_docs_editor_sec_node.yml +# upgrade actually uses the cfg file in the program folder but updating it anyway in case we need it - name: Edit cfg.node.properties replace: path: "{{ __conversion_cfg_prop_location }}/cfg.node.properties" @@ -37,27 +36,45 @@ - { prop_name: "was_install_root", prop_value: "{{ __was_install_root_r }}" } - { prop_name: "non_job_mgr_mode", prop_value: "{{ __non_job_mgr_mode_r }}" } - { prop_name: "viewer_url", prop_value: "{{ __viewer_url_r }}" } - when: not conversion_current_node_already_installed.stat.exists + when: not conversion_already_installed|bool or conversion_upgrade|bool -- name: Run the Docs Conversion installer for the second node +- name: Run the Docs Conversion installer for the second node (fresh) shell: chdir: "{{ __extraction_folder }}/{{ __conversion_install_folder }}/installer" cmd: "./install_node.sh -wasadminID {{ was_username }} -wasadminPW {{ was_password }} -configFile cfg.node.properties -acceptLicense -silentlyInstall" become: true when: - - not conversion_current_node_already_installed.stat.exists + - not conversion_already_installed|bool - conversion_first_already_installed.stat.exists |bool register: sec_install_performed -- name: Search for success message in install log +- name: Run the Docs Conversion installer for the second node (upgrade) + shell: + chdir: "{{ __extraction_folder }}/{{ __conversion_install_folder }}/installer" + cmd: "./upgrade_node.sh -wasadminID {{ was_username }} -wasadminPW {{ was_password }} -acceptLicense -silentlyInstall -installRoot {{ __docs_conversion_install_location }}" + become: true + when: + - conversion_upgrade|bool + - conversion_first_already_installed.stat.exists |bool + register: sec_upgrade_performed + +- name: Search for success message in install log (fresh) become: yes shell: "grep -i '{{ __install_success_message_node }}' {{ __docs_conversion_install_location }}/logs/conversion_install_node.log" - register: conversion_success_message_found - failed_when: conversion_success_message_found.stdout|length == 0 + register: conversion_install_success_message_found + failed_when: conversion_install_success_message_found.stdout|length == 0 when: sec_install_performed is not skipped +- name: Search for success message in install log (upgrade) + become: yes + shell: "grep -i '{{ __upgrade_success_message }}' {{ __docs_conversion_install_location }}/logs/conversion_upgrade_node.log" + register: conversion_upgrade_success_message_found + failed_when: conversion_upgrade_success_message_found.stdout|length == 0 + when: sec_upgrade_performed is not skipped + - name: "Create {{ __conversion_install_success_file }} file" file: path: "{{ __conversion_install_success_file }}" state: touch - when: sec_install_performed is not skipped and conversion_success_message_found.stdout|length > 0 + when: sec_install_performed is not skipped and conversion_install_success_message_found.stdout|length > 0 or + sec_upgrade_performed is not skipped and conversion_upgrade_success_message_found.stdout|length > 0 diff --git a/roles/hcl/docs/tasks/install_docs_editor.yml b/roles/hcl/docs/tasks/install_docs_editor.yml index 8b666e7d..843d8d0a 100644 --- a/roles/hcl/docs/tasks/install_docs_editor.yml +++ b/roles/hcl/docs/tasks/install_docs_editor.yml @@ -1,16 +1,18 @@ --- -- name: Verify if Docs Editor is already installed - stat: - path: "{{ __editor_install_success_file }}" - register: editor_already_installed +- name: Is Docs Editor already installed? + debug: var=editor_already_installed + +- name: Is this a Docs Editor upgrade? + debug: var=editor_upgrade - name: Get database type include_tasks: get_db_type.yml - when: not editor_already_installed.stat.exists + when: not editor_already_installed|bool or editor_upgrade|bool - name: Print database type debug: var=__db_type_prop_value +# upgrade actually uses the cfg file in the program folder but updating it anyway in case we need it - name: Edit cfg.properties replace: path: "{{ __editor_cfg_prop_location }}/cfg.properties" @@ -33,7 +35,7 @@ - { prop_name: "conversion_url", prop_value: "{{ __conversion_url_r }}" } - { prop_name: "files_url", prop_value: "{{ __files_url_r }}" } - { prop_name: "email_url", prop_value: "{{ __email_url_r }}" } - when: not editor_already_installed.stat.exists + when: not editor_already_installed|bool or editor_upgrade|bool # need to copy cfg to cfg.node before install per documentation - name: Copy cfg.properties to cfg.node.properties @@ -41,26 +43,43 @@ src: "{{ __editor_cfg_prop_location }}/cfg.properties" dest: "{{ __editor_cfg_prop_location }}/cfg.node.properties" remote_src: yes - when: not editor_already_installed.stat.exists + when: not editor_already_installed|bool or editor_upgrade|bool -- name: Run the Docs Editor installer +- name: Run the Docs Editor installer (fresh) shell: chdir: "{{ __extraction_folder }}/{{ __editor_install_folder }}/installer" cmd: "./install.sh -wasadminID {{ was_username }} -wasadminPW {{ was_password }} -dbadminID {{ __db_concord_username }} -dbadminPW {{ db_concord_password }} -mapWebserver true -acceptLicense -silentlyInstall" become: true when: - - not editor_already_installed.stat.exists - register: sec_install_performed + - not editor_already_installed|bool + register: install_performed + +- name: Run the Docs Editor installer (upgrade) + shell: + chdir: "{{ __extraction_folder }}/{{ __editor_install_folder }}/installer" + cmd: "./upgrade.sh -wasadminID {{ was_username }} -wasadminPW {{ was_password }} -dbadminID {{ __db_concord_username }} -dbadminPW {{ db_concord_password }} -acceptLicense -silentlyInstall -installRoot {{ __docs_editor_install_location }}" + become: true + when: + - editor_upgrade|bool + register: upgrade_performed -- name: Search for success message in install log +- name: Search for success message in install log (fresh) become: yes shell: "grep -i '{{ __install_success_message }}' {{ __docs_editor_install_location }}/logs/docs_install.log" - register: editor_success_message_found - failed_when: editor_success_message_found.stdout|length == 0 - when: sec_install_performed is not skipped + register: editor_install_success_message_found + failed_when: editor_install_success_message_found.stdout|length == 0 + when: install_performed is not skipped + +- name: Search for success message in install log (upgrade) + become: yes + shell: "grep -i '{{ __upgrade_success_message }}' {{ __docs_editor_install_location }}/logs/docs_upgrade.log" + register: editor_upgrade_success_message_found + failed_when: editor_upgrade_success_message_found.stdout|length == 0 + when: upgrade_performed is not skipped - name: "Create {{ __editor_install_success_file }} file" file: path: "{{ __editor_install_success_file }}" state: touch - when: sec_install_performed is not skipped and editor_success_message_found.stdout|length > 0 + when: install_performed is not skipped and editor_install_success_message_found.stdout|length > 0 or + upgrade_performed is not skipped and editor_upgrade_success_message_found.stdout|length > 0 diff --git a/roles/hcl/docs/tasks/install_docs_editor_ext.yml b/roles/hcl/docs/tasks/install_docs_editor_ext.yml index 02de0b2c..2b1d44ed 100644 --- a/roles/hcl/docs/tasks/install_docs_editor_ext.yml +++ b/roles/hcl/docs/tasks/install_docs_editor_ext.yml @@ -1,11 +1,14 @@ -- name: Verify if Docs Editor Extension is already installed - stat: - path: "{{ __docs_editor_ext_install_success_file }}" - register: editor_ext_already_installed +--- +- name: Is Docs Editor Extension already installed? + debug: var=docs_ext_already_installed + +- name: Is this a Docs Editor Extension upgrade? + debug: var=docs_ext_upgrade - name: Get the names of the clusters include_tasks: get_cluster_names.yml +# upgrade actually uses the cfg file in the program folder but updating it anyway in case we need it - name: Edit cfg.properties replace: path: "{{ __editor_ext_cfg_prop_location }}/cfg.properties" @@ -24,7 +27,7 @@ - { prop_name: "docs_admin_j2c_alias", prop_value: "{{ __docs_admin_j2c_alias_r }}" } - { prop_name: "ccm_enabled", prop_value: "{{ __ccm_enabled_r }}" } when: - - not editor_ext_already_installed.stat.exists + - not docs_ext_already_installed|bool or docs_ext_upgrade|bool - name: Add more properties to cfg.properties lineinfile: @@ -34,27 +37,44 @@ with_items: - { prop_name: "auth_type=", prop_value: "auth_type={{ __auth_type_r }}" } when: - - not editor_ext_already_installed.stat.exists + - not docs_ext_already_installed|bool or docs_ext_upgrade|bool # Note: Documentation says it can be installed on one of the HCL Connections server -- name: Run the Docs Editor Extension installer +- name: Run the Docs Editor Extension installer (fresh) shell: chdir: "{{ __extraction_folder }}/DocsCnxExtension/installer" cmd: "./install.sh -wasadminID {{ was_username }} -wasadminPW {{ was_password }} -acceptLicense -silentlyInstall" become: true when: - - not editor_ext_already_installed.stat.exists - register: sec_install_performed + - not docs_ext_already_installed|bool + register: install_performed + +- name: Run the Docs Editor Extension installer (upgrade) + shell: + chdir: "{{ __extraction_folder }}/DocsCnxExtension/installer" + cmd: "./upgrade.sh -wasadminID {{ was_username }} -wasadminPW {{ was_password }} -acceptLicense -silentlyInstall -installRoot {{ __docs_editor_ext_install_location }}" + become: true + when: + - docs_ext_upgrade|bool + register: upgrade_performed -- name: Search for success message in install log +- name: Search for success message in install log (fresh) become: yes shell: "grep -i '{{ __install_success_message }}' {{ __docs_editor_ext_install_location }}/logs/icext_install.log" register: editor_ext_success_message_found failed_when: editor_ext_success_message_found.stdout|length == 0 - when: sec_install_performed is not skipped + when: install_performed is not skipped + +- name: Search for success message in install log (upgrade) + become: yes + shell: "grep -i '{{ __upgrade_success_message }}' {{ __docs_editor_ext_install_location }}/logs/icext_upgrade.log" + register: editor_ext_upgrade_success_message_found + failed_when: editor_ext_upgrade_success_message_found.stdout|length == 0 + when: upgrade_performed is not skipped - name: "Create {{ __docs_editor_ext_install_success_file }} file" file: path: "{{ __docs_editor_ext_install_success_file }}" state: touch - when: sec_install_performed is not skipped and editor_ext_success_message_found.stdout|length > 0 + when: install_performed is not skipped and editor_ext_success_message_found.stdout|length > 0 or + upgrade_performed is not skipped and editor_ext_upgrade_success_message_found.stdout|length > 0 diff --git a/roles/hcl/docs/tasks/install_docs_editor_proxy.yml b/roles/hcl/docs/tasks/install_docs_editor_proxy.yml index fb2b288c..6597e5cf 100644 --- a/roles/hcl/docs/tasks/install_docs_editor_proxy.yml +++ b/roles/hcl/docs/tasks/install_docs_editor_proxy.yml @@ -1,7 +1,9 @@ -- name: Verify if Docs Editor Proxy is already installed - stat: - path: "{{ __editor_proxy_install_success_file }}" - register: editor_proxy_already_installed +--- +- name: Is Docs Editor Proxy is already installed? + debug: var=editor_proxy_already_installed + +- name: Is this a Docs Editor Proxy upgrade? + debug: var=editor_proxy_upgrade - name: Edit cfg.properties replace: @@ -15,27 +17,45 @@ - { prop_name: "scope", prop_value: "{{ __scope_r }}" } - { prop_name: "docs_scope_name", prop_value: "{{ __docs_scope_name_r }}" } when: - - not editor_proxy_already_installed.stat.exists + - not editor_proxy_already_installed|bool or editor_proxy_upgrade|bool # Note: Documentation says only need to install on one of the HCL Docs Proxy server nodes. -- name: Run the Docs Editor Proxy installer +# upgrade actually uses the cfg file in the program folder but updating it anyway in case we need it +- name: Run the Docs Editor Proxy installer (fresh) shell: chdir: "{{ __extraction_folder }}/{{ __proxy_install_folder }}/installer" cmd: "./install.sh -wasadminID {{ was_username }} -wasadminPW {{ was_password }} -configFile cfg.properties -acceptLicense" become: true when: - - not editor_proxy_already_installed.stat.exists - register: sec_install_performed + - not editor_proxy_already_installed|bool + register: install_performed + +- name: Run the Docs Editor Proxy installer (upgrade) + shell: + chdir: "{{ __extraction_folder }}/{{ __proxy_install_folder }}/installer" + cmd: "./upgrade.sh -wasadminID {{ was_username }} -wasadminPW {{ was_password }} -acceptLicense -installRoot {{ __docs_editor_install_location }}" + become: true + when: + - editor_proxy_upgrade|bool + register: upgrade_performed -- name: Search for success message in install log +- name: Search for success message in install log (fresh) become: yes shell: "grep -i '{{ __install_success_message }}' {{ __docs_editor_install_location }}/proxy/logs/proxy_install.log" register: editor_proxy_success_message_found failed_when: editor_proxy_success_message_found.stdout|length == 0 - when: sec_install_performed is not skipped + when: install_performed is not skipped + +- name: Search for success message in install log (upgrade) + become: yes + shell: "grep -i '{{ __upgrade_success_message }}' {{ __docs_editor_install_location }}/proxy/logs/proxy_upgrade.log" + register: editor_proxy_upgrade_success_message_found + failed_when: editor_proxy_upgrade_success_message_found.stdout|length == 0 + when: upgrade_performed is not skipped - name: "Create {{ __editor_proxy_install_success_file }} file" file: path: "{{ __editor_proxy_install_success_file }}" state: touch - when: sec_install_performed is not skipped and editor_proxy_success_message_found.stdout|length > 0 + when: install_performed is not skipped and editor_proxy_success_message_found.stdout|length > 0 or + upgrade_performed is not skipped and editor_proxy_upgrade_success_message_found.stdout|length > 0 diff --git a/roles/hcl/docs/tasks/install_docs_editor_sec_node.yml b/roles/hcl/docs/tasks/install_docs_editor_sec_node.yml index 08886515..42ca99ab 100644 --- a/roles/hcl/docs/tasks/install_docs_editor_sec_node.yml +++ b/roles/hcl/docs/tasks/install_docs_editor_sec_node.yml @@ -5,28 +5,27 @@ register: editor_first_already_installed delegate_to: "{{ groups['docs_servers'][0] }}" -- name: Verify if Docs Editor is already installed on subsequent node - stat: - path: "{{ __editor_install_success_file }}" - register: editor_current_already_installed - - debug: var=editor_first_already_installed.stat.exists run_once: true -- debug: var=editor_current_already_installed.stat.exists - run_once: true +- name: Is Docs Editor already installed on this subsequent node? + debug: var=editor_already_installed + +- name: Is this a Docs Editor upgrade? + debug: var=editor_upgrade # orig cfg.node.properties is missing properties, also documentation says use node.properties from 1st node and rename to cfg.node.properties +# upgrade actually uses the cfg file in the program folder but updating it anyway in case we need it - name: Copy cfg.properties to cfg.node.properties copy: src: "{{ __editor_cfg_prop_location }}/cfg.properties" dest: "{{ __editor_cfg_prop_location }}/cfg.node.properties" remote_src: yes - when: not editor_current_already_installed.stat.exists + when: not editor_already_installed|bool or editor_upgrade|bool - name: Get database type include_tasks: get_db_type.yml - when: not editor_current_already_installed.stat.exists + when: not editor_already_installed|bool or editor_upgrade|bool - name: Edit cfg.node.properties replace: @@ -50,27 +49,45 @@ - { prop_name: "conversion_url", prop_value: "{{ __conversion_url_r }}" } - { prop_name: "files_url", prop_value: "{{ __files_url_r }}" } - { prop_name: "email_url", prop_value: "{{ __email_url_r }}" } - when: not editor_current_already_installed.stat.exists + when: not editor_already_installed|bool or editor_upgrade|bool -- name: Run the Docs Editor installer for the second node +- name: Run the Docs Editor installer for the second node (fresh) shell: chdir: "{{ __extraction_folder }}/{{ __editor_install_folder }}/installer" cmd: "./install_node.sh -wasadminID {{ was_username }} -wasadminPW {{ was_password }} -dbadminID {{ __db_concord_username }} -dbadminPW {{ db_concord_password }} -configFile cfg.node.properties -acceptLicense -silentlyInstall" become: true when: - - not editor_current_already_installed.stat.exists + - not editor_already_installed|bool - editor_first_already_installed.stat.exists |bool register: sec_install_performed -- name: Search for success message in install log +- name: Run the Docs Editor installer for the second node (upgrade) + shell: + chdir: "{{ __extraction_folder }}/{{ __editor_install_folder }}/installer" + cmd: "./upgrade_node.sh -wasadminID {{ was_username }} -wasadminPW {{ was_password }} -dbadminID {{ __db_concord_username }} -dbadminPW {{ db_concord_password }} -acceptLicense -silentlyInstall -installRoot {{ __docs_editor_install_location }}" + become: true + when: + - editor_upgrade|bool + - editor_first_already_installed.stat.exists |bool + register: sec_upgrade_performed + +- name: Search for success message in install log (fresh) become: yes shell: "grep -i '{{ __install_success_message_node }}' {{ __docs_editor_install_location }}/logs/docs_install_node.log" - register: editor_success_message_found - failed_when: editor_success_message_found.stdout|length == 0 + register: editor_install_success_message_found + failed_when: editor_install_success_message_found.stdout|length == 0 when: sec_install_performed is not skipped +- name: Search for success message in install log (upgrade) + become: yes + shell: "grep -i '{{ __upgrade_success_message }}' {{ __docs_editor_install_location }}/logs/docs_upgrade_node.log" + register: editor_upgrade_success_message_found + failed_when: editor_upgrade_success_message_found.stdout|length == 0 + when: sec_upgrade_performed is not skipped + - name: "Create {{ __editor_install_success_file }} file" file: path: "{{ __editor_install_success_file }}" state: touch - when: sec_install_performed is not skipped and editor_success_message_found.stdout|length > 0 + when: sec_install_performed is not skipped and editor_install_success_message_found.stdout|length > 0 or + sec_upgrade_performed is not skipped and editor_upgrade_success_message_found.stdout|length > 0 diff --git a/roles/hcl/docs/tasks/install_docs_viewer.yml b/roles/hcl/docs/tasks/install_docs_viewer.yml index ce6be5f9..65ce5081 100644 --- a/roles/hcl/docs/tasks/install_docs_viewer.yml +++ b/roles/hcl/docs/tasks/install_docs_viewer.yml @@ -1,22 +1,24 @@ -- name: Verify if Docs Viewer is already installed - stat: - path: "{{ __viewer_install_success_file }}" - register: viewer_already_installed +--- +- name: Is Docs Viewer already installed? + debug: var=viewer_already_installed + +- name: Is this a Docs Viewer upgrade? + debug: var=viewer_upgrade - name: Get CNX shared data mount target for {{ __nfsMasterAddress }}:{{ __cnx_data_remote_path }} shell: "findmnt --source {{ __nfsMasterAddress }}:{{ __cnx_data_remote_path }} -o target -n | head -n 1" register: cnx_data_mount_target failed_when: cnx_data_mount_target.stdout|length == 0 when: - - not viewer_already_installed.stat.exists + - not viewer_already_installed|bool or viewer_upgrade|bool - __cnx_shared_storage_type == 'nfs' - debug: var=cnx_data_mount_target when: - - not viewer_already_installed.stat.exists + - not viewer_already_installed|bool or viewer_upgrade|bool - cnx_data_mount_target is defined - +# upgrade actually uses the cfg file in the program folder but updating it anyway in case we need it - name: Edit cfg.properties replace: path: "{{ __viewer_cfg_prop_location }}/cfg.properties" @@ -34,32 +36,46 @@ - { prop_name: "scope", prop_value: "{{ __scope_r }}" } - { prop_name: "files_url", prop_value: "{{ __files_url_r }}" } - { prop_name: "docs_url", prop_value: "{{ __docs_url_r }}" } - - { prop_name: "ecm_fncmis_server_url", prop_value: "{{ __ecm_fncmis_server_url }}" } - - { prop_name: "ecm_fncs_server_url", prop_value: "{{ __ecm_fncs_server_url }}" } - - { prop_name: "ecm_community_server_url", prop_value: "{{ __ecm_community_server_url }}" } when: - - not viewer_already_installed.stat.exists + - not viewer_already_installed|bool or viewer_upgrade|bool # Note: documentation says only need to install File Viewer on one of the nodes in the cluster as this makes all the config and other install files available to any additional File Viewer node in the cluster. -- name: Run the Docs Viewer installer +- name: Run the Docs Viewer installer (fresh) shell: chdir: "{{ __extraction_folder }}/{{ __viewer_install_folder }}/installer" cmd: "./install.sh -wasadminID {{ was_username }} -wasadminPW {{ was_password }} -configFile cfg.properties -mapWebserver true -acceptLicense" become: true when: - - not viewer_already_installed.stat.exists - register: sec_install_performed + - not viewer_already_installed|bool + register: install_performed -- name: Search for success message in install log +- name: Run the Docs Viewer installer (upgrade) + shell: + chdir: "{{ __extraction_folder }}/{{ __viewer_install_folder }}/installer" + cmd: "./upgrade.sh -wasadminID {{ was_username }} -wasadminPW {{ was_password }} -mapWebserver true -acceptLicense -installRoot {{ __docs_viewer_install_location }}" + become: true + when: + - viewer_upgrade|bool + register: upgrade_performed + +- name: Search for success message in install log (fresh) become: yes shell: "grep -i '{{ __install_success_message }}' {{ __docs_viewer_install_location }}/logs/viewerInstall.log" - register: viewer_success_message_found - failed_when: viewer_success_message_found.stdout|length == 0 - when: sec_install_performed is not skipped + register: viewer_install_success_message_found + failed_when: viewer_install_success_message_found.stdout|length == 0 + when: install_performed is not skipped + +- name: Search for success message in install log (upgrade) + become: yes + shell: "grep -i '{{ __upgrade_success_message }}' {{ __docs_viewer_install_location }}/logs/viewerUpgrade.log" + register: viewer_upgrade_success_message_found + failed_when: viewer_upgrade_success_message_found.stdout|length == 0 + when: upgrade_performed is not skipped - name: "Create {{ __viewer_install_success_file }} file" file: path: "{{ __viewer_install_success_file }}" state: touch - when: sec_install_performed is not skipped and viewer_success_message_found.stdout|length > 0 + when: install_performed is not skipped and viewer_install_success_message_found.stdout|length > 0 or + upgrade_performed is not skipped and viewer_upgrade_success_message_found.stdout|length > 0 diff --git a/roles/hcl/docs/tasks/install_docs_viewer_ext.yml b/roles/hcl/docs/tasks/install_docs_viewer_ext.yml index d2a637d6..ed2d15c4 100644 --- a/roles/hcl/docs/tasks/install_docs_viewer_ext.yml +++ b/roles/hcl/docs/tasks/install_docs_viewer_ext.yml @@ -1,11 +1,14 @@ -- name: Verify if Docs Viewer Extension is already installed - stat: - path: "{{ __docs_viewer_ext_install_success_file }}" - register: viewer_ext_already_installed +--- +- name: Is Docs Viewer Extension already installed? + debug: var=viewer_ext_already_installed + +- name: Is this a Docs Viewer Extension upgrade? + debug: var=viewer_ext_upgrade - name: Get the names of the clusters include_tasks: get_cluster_names.yml +# upgrade actually uses the cfg file in the program folder but updating it anyway in case we need it - name: Edit cfg.properties replace: path: "{{ __viewer_ext_cfg_prop_location }}/cfg.properties" @@ -23,7 +26,7 @@ - { prop_name: "enable_upload_conversion", prop_value: "{{ __enable_upload_conversion_r }}" } - { prop_name: "viewer_admin_j2c_alias", prop_value: "{{ __viewer_admin_j2c_alias_r }}" } when: - - not viewer_ext_already_installed.stat.exists + - not viewer_ext_already_installed|bool or viewer_ext_upgrade|bool - name: Add more properties to cfg.properties lineinfile: @@ -33,27 +36,44 @@ with_items: - { prop_name: "auth_type=", prop_value: "auth_type={{ __auth_type_r }}" } when: - - not viewer_ext_already_installed.stat.exists + - not viewer_ext_already_installed|bool or viewer_ext_upgrade|bool # Note: Documentation says it can be installed on one of the HCL Connections server -- name: Run the Docs Viewer Extension installer +- name: Run the Docs Viewer Extension installer (fresh) shell: chdir: "{{ __extraction_folder }}/ViewerCnxExtension/installer" cmd: "./install.sh -wasadminID {{ was_username }} -wasadminPW {{ was_password }} -configFile cfg.properties -acceptLicense" become: true when: - - not viewer_ext_already_installed.stat.exists - register: sec_install_performed + - not viewer_ext_already_installed|bool + register: install_performed + +- name: Run the Docs Viewer Extension installer (upgrade) + shell: + chdir: "{{ __extraction_folder }}/ViewerCnxExtension/installer" + cmd: "./upgrade.sh -wasadminID {{ was_username }} -wasadminPW {{ was_password }} -acceptLicense -installRoot {{ __docs_viewer_ext_install_location }}" + become: true + when: + - viewer_ext_upgrade|bool + register: upgrade_performed -- name: Search for success message in install log +- name: Search for success message in install log (fresh) become: yes shell: "grep -i '{{ __install_success_message }}' {{ __docs_viewer_ext_install_location }}/logs/extensionInstall.log" register: viewer_ext_success_message_found failed_when: viewer_ext_success_message_found.stdout|length == 0 - when: sec_install_performed is not skipped + when: install_performed is not skipped + +- name: Search for success message in install log (upgrade) + become: yes + shell: "grep -i '{{ __upgrade_success_message_2 }}' {{ __docs_viewer_ext_install_location }}/logs/extensionUpgrade.log" + register: viewer_ext_upgrade_success_message_found + failed_when: viewer_ext_upgrade_success_message_found.stdout|length == 0 + when: upgrade_performed is not skipped - name: "Create {{ __docs_viewer_ext_install_success_file }} file" file: path: "{{ __docs_viewer_ext_install_success_file }}" state: touch - when: sec_install_performed is not skipped and viewer_ext_success_message_found.stdout|length > 0 + when: install_performed is not skipped and viewer_ext_success_message_found.stdout|length > 0 or + upgrade_performed is not skipped and viewer_ext_upgrade_success_message_found.stdout|length > 0 diff --git a/roles/hcl/docs/tasks/main.yml b/roles/hcl/docs/tasks/main.yml index 6b599c42..c0015d22 100644 --- a/roles/hcl/docs/tasks/main.yml +++ b/roles/hcl/docs/tasks/main.yml @@ -3,12 +3,15 @@ - include_vars: ../create_docs_clusters/vars/main.yml - name: Check Vars - include_tasks: check_vars.yml + include_tasks: + file: check_vars.yml + apply: + any_errors_fatal: true - name: Pre-check DB2 version include_tasks: precheck_DB2_version.yml when: - - "'db2_servers' in groups" + - "'db2_servers' in groups" - name: Download Docs installer to Docs env include_tasks: download_docs.yml diff --git a/roles/hcl/docs/tasks/version_check.yml b/roles/hcl/docs/tasks/version_check.yml new file mode 100644 index 00000000..2130d54f --- /dev/null +++ b/roles/hcl/docs/tasks/version_check.yml @@ -0,0 +1,55 @@ +--- +- name: "Find {{ name }} install success file" + stat: + path: "{{ success_file }}" + register: already_installed_success_file + +- name: "Find {{ name }} product file" + find: + paths: "{{ program_path }}/{{ product_file_path}}" + patterns: "{{ product_file_pattern }}" + register: product_file + ignore_errors: true + +- name: "Exit when old {{ name }} install files are found" + fail: + msg: "{{ success_file }} is found but {{ name }} is not fully installed. If it has been uninstalled please remove the directory before installing again." + when: + - already_installed_success_file.stat.exists + - product_file.matched|int == 0 + +- name: "Determine if {{ name }} is already installed" + set_fact: + "{{ already_installed_var }}": "{{ true if (already_installed_success_file.stat.exists and product_file.matched|int > 0) else false }}" + component_already_installed: "{{ true if (already_installed_success_file.stat.exists and product_file.matched|int > 0) else false }}" + +- name: "Is {{ name }} installed?" + debug: var="{{ already_installed_var }}" + +- name: "Read {{ name }} version file if installed" + slurp: + src: "{{ version_string_path }}" + register: component_config_json + when: + - component_already_installed |bool + +- name: "Get {{ name }} version if installed" + set_fact: + "{{ component_var }}_version": "{{ component_config_json['content'] | b64decode | regex_search(' ?\"build_version\" ?: ?\"(.+)\"', '\\1') | first }}" + component_version: "{{ component_config_json['content'] | b64decode | regex_search(' ?\"build_version\" ?: ?\"(.+)\"', '\\1') | first }}" + when: + - component_already_installed |bool + +- name: "Print {{ name }} version if installed" + debug: var={{ component_var}}_version + when: + - component_already_installed |bool + +- name: "Show me __docs_updates_enabled" + debug: var=__docs_updates_enabled + +# Docs python script does not allow running upgrade on same version +- name: Determine if {{ name }} can be upgraded + set_fact: + "{{ upgrade_var }}": "{{ false if component_version is not defined else true if (component_version is version( __docs_install_version, '<') and __docs_updates_enabled|bool) else false }}" + upgrade_eligable: "{{ false if component_version is not defined else true if (component_version is version( __docs_install_version, '<') and __docs_updates_enabled|bool) else false }}" diff --git a/roles/hcl/docs/vars/main.yml b/roles/hcl/docs/vars/main.yml index b10413ed..4fc75d42 100644 --- a/roles/hcl/docs/vars/main.yml +++ b/roles/hcl/docs/vars/main.yml @@ -1,7 +1,10 @@ --- __setup_environment: "{{ setup_environment | default(true) }}" __download_location: "{{ cnx_docs_download_location | default('http://c7lb1.cnx.cwp.pnp-hcl.com:8001/Docs') }}" -__package_name: "{{ cnx_docs_package_name | default('IBMConnectionsDocs_2.0.1.zip') }}" +__package_name: "{{ cnx_docs_package_name | default('HCL_Docs_v202.zip') }}" +__docs_install_version: "{{ docs_install_version | default('2.0.2') }}" +__docs_updates_enabled: "{{ docs_updates_enabled | default(true) }}" + __hcl_program_folder: "{{ hcl_program_folder | default('/opt/HCL') }}" __extraction_folder: "{{ __hcl_program_folder }}/InstallBinaries/Docs" __installation_folder: "{{ __extraction_folder }}" @@ -17,6 +20,8 @@ __docs_viewer_ext_install_location: "{{ __hcl_program_folder }}/{{ __view __install_success_message: "Installation Completed Successfully" __install_success_message_node: "Deployment on node completed successfully" __uninstall_success_message: "Uninstall successfully" +__upgrade_success_message: "Upgrade completed successfully" +__upgrade_success_message_2: "Upgrade successfully" # __was_install_location: "{{ was_install_location | default('/opt/IBM/WebSphere/AppServer') }}" __dmgr_profile_name: "{{ profile_name | default('Dmgr01') }}" @@ -99,9 +104,6 @@ __files_path_r: "{{ __cnx_data_local_path }}/files/upl __editor_installed_r: "Yes" __viewer_scope_name_r: "{{ __viewer_cluster_name }}" __docs_url_r: "https://{{ docs_url }}/docs" -__ecm_fncmis_server_url: "" -__ecm_fncs_server_url: "" -__ecm_community_server_url: "" # Docs Editor Proxy install config @@ -134,7 +136,6 @@ __auth_type_r: "BASIC" __viewer_server_url_r: "https://{{ docs_url }}/viewer" __viewer_admin_j2c_alias_r: "connectionsAdmin" - __conversion_install_success_file: "{{ __docs_conversion_install_location }}/docs.conversion.installed.success" __editor_install_success_file: "{{ __docs_editor_install_location }}/docs.editor.installed.success" __viewer_install_success_file: "{{ __docs_viewer_install_location }}/docs.viewer.installed.success"