Skip to content

Commit

Permalink
sept-2022-docs202 (#213)
Browse files Browse the repository at this point in the history
  • Loading branch information
sabrina-yee authored Sep 8, 2022
1 parent a347136 commit cddd48f
Show file tree
Hide file tree
Showing 17 changed files with 446 additions and 132 deletions.
2 changes: 1 addition & 1 deletion documentation/VARIABLES.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion roles/hcl/connections-wizards/vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
4 changes: 2 additions & 2 deletions roles/hcl/docs/setup-environment/tasks/setup_os.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
92 changes: 92 additions & 0 deletions roles/hcl/docs/tasks/check_vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
7 changes: 6 additions & 1 deletion roles/hcl/docs/tasks/cleanup_env.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -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
Expand All @@ -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
24 changes: 17 additions & 7 deletions roles/hcl/docs/tasks/download_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand All @@ -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
47 changes: 33 additions & 14 deletions roles/hcl/docs/tasks/install_docs_conversion.yml
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -23,34 +25,51 @@
- { 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
copy:
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
45 changes: 31 additions & 14 deletions roles/hcl/docs/tasks/install_docs_conversion_sec_node.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Loading

0 comments on commit cddd48f

Please sign in to comment.