From 90c629d925c1beb9d3ee6d26aeb31e7112663cd8 Mon Sep 17 00:00:00 2001 From: sian Date: Mon, 11 Oct 2021 21:08:10 +0100 Subject: [PATCH] WAS - Optional Download ( alternative to copy ) (#19) * add compose to our molecule test image * first try - optio to download * update readme * remove db2 downloads from script * refactor db2 11.1 * remove blank line from Travis * add line to readme * add new vars to readme * follow on * update galaxy version * update readme * update 8.5.5 molecule to also use download * fix download script --- galaxy.yml | 2 +- molecule/__websphere-v85/converge.yml | 2 + molecule/__websphere-v90/converge.yml | 2 + roles/db2/README.md | 10 ++--- roles/websphere/README.md | 23 ++++++++-- roles/websphere/defaults/main.yml | 8 ++-- roles/websphere/tasks/configure.yml | 4 +- roles/websphere/tasks/env.yml | 3 -- roles/websphere/tasks/fixpack_install.yml | 32 +++++++++++++- roles/websphere/tasks/main.yml | 4 -- roles/websphere/tasks/v85_base_install.yml | 33 ++++++++++++--- roles/websphere/tasks/v90_base_install.yml | 49 +++++++++++++++++----- roles/websphere/vars/v8.5.5.17.yml | 1 + roles/websphere/vars/v9.0.5.3.yml | 14 ++++--- roles/websphere/vars/v9.0.5.7.yml | 14 ++++--- roles/websphere/vars/v9.0.5.8.yml | 14 ++++--- scripts/downloadInstaller.sh | 22 +--------- 17 files changed, 157 insertions(+), 80 deletions(-) diff --git a/galaxy.yml b/galaxy.yml index b38e8b4..75c4cd1 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -10,7 +10,7 @@ namespace: ibm name: spm_middleware # The version of the collection. Must be compatible with semantic versioning -version: 1.0.6 +version: 1.0.7 # The path to the Markdown (.md) readme file. This path is relative to the root of the collection readme: README.md diff --git a/molecule/__websphere-v85/converge.yml b/molecule/__websphere-v85/converge.yml index 8013eb7..05ff419 100644 --- a/molecule/__websphere-v85/converge.yml +++ b/molecule/__websphere-v85/converge.yml @@ -7,6 +7,8 @@ vars: websphere_version: 8.5.5.17 + download_url: "{{ lookup('env', 'ARTIFACTORY_URL') }}/{{ lookup('env', 'ARTIFACTORY_REPO') }}/SoftwareInstallers" + download_header: { 'X-JFrog-Art-Api': "{{ lookup('env', 'ARTIFACTORY_TOKEN') }}"} roles: - iim diff --git a/molecule/__websphere-v90/converge.yml b/molecule/__websphere-v90/converge.yml index f2fd2e4..4cd3723 100644 --- a/molecule/__websphere-v90/converge.yml +++ b/molecule/__websphere-v90/converge.yml @@ -7,6 +7,8 @@ vars: websphere_version: 9.0.5.8 + download_url: "{{ lookup('env', 'ARTIFACTORY_URL') }}/{{ lookup('env', 'ARTIFACTORY_REPO') }}/SoftwareInstallers" + download_header: { 'X-JFrog-Art-Api': "{{ lookup('env', 'ARTIFACTORY_TOKEN') }}"} roles: - iim diff --git a/roles/db2/README.md b/roles/db2/README.md index a9e44dd..68939b1 100644 --- a/roles/db2/README.md +++ b/roles/db2/README.md @@ -19,17 +19,17 @@ Ensure you update / override password variables prior to using the role. | ------------------------- | --------------------------------------------------- | | `db2_db_create` | `True` | | `db2_db_name` | `DATABASE` | -| `db2_db_username` | `db2admin` | -| `db2_db_password` | `db2admin` | -| `db2_db_spm_enc` | `dummyPassword` | +| `db2_db_username` | `db2admin` | +| `db2_db_password` | `db2admin` | +| `db2_db_spm_enc` | `dummyPassword` | | `db2_db_drop_required` | `False` | | ------------------------- | --------------------------------------------------- | | `bootstrap_dateformat` | `dd MM yyyy` | | `bootstrap_dateseparator` | `/` | | `bootstrap_dmx_locale` | `en_US` | | ------------------------- | --------------------------------------------------- | -| `download_url` | # set this if license and installer is being downloaded from a http server | -| `download_header` | # Use this in conjunction with `download_url` | +| `download_url` | # set this if license and installer is being downloaded from a http server| +| `download_header` | # Use this in conjunction with `download_url` | | ------------------------- | --------------------------------------------------- | diff --git a/roles/websphere/README.md b/roles/websphere/README.md index ad07821..39b8216 100644 --- a/roles/websphere/README.md +++ b/roles/websphere/README.md @@ -15,18 +15,33 @@ IBM Installation Manager (1.9.x) must already be installed in the target environ | ------------------------ | --------------------------------------------------- | | `iim_install_path` | `/opt/IBM/InstallationManager` | | `profiled_path` | `/opt/profile.d` | +| ------------------------- | --------------------------------------------------- | +| `download_url` | # set this if license and installer is being downloaded from a http server| +| `download_header` | # Use this in conjunction with `download_url` | +| ------------------------- | --------------------------------------------------- | ## Dependencies -None +ibm.spm_middleware.iim ## Example Playbook ``` -- hosts: servers +--- +- name: Converge + hosts: all + + collections: + - ibm.spm_middleware + + vars: + websphere_version: 9.0.5.8 + download_url: "https://myserver.com/was/repos" + download_header: { 'Authorization': 'Basic EncodedString'} + roles: - - role: spm_middleware.websphere - websphere_version: 9.0.5.7 + - ibm.spm_middleware.iim + - ibm.spm_middleware.websphere ``` ## License diff --git a/roles/websphere/defaults/main.yml b/roles/websphere/defaults/main.yml index 1ce553b..2c59dfd 100644 --- a/roles/websphere/defaults/main.yml +++ b/roles/websphere/defaults/main.yml @@ -1,9 +1,11 @@ --- +# iim iim_install_path: /opt/IBM/InstallationManager - +# websphere websphere_install_path: /opt/IBM/WebSphere/AppServer - websphere_version: 9.0.5.8 - # Common profiled_path: /opt/profile.d +# Server info for downloading installers / repos directly, leave blank to copy +download_url: # e.g. https://artifactory/repo +download_header: # e.g. X-JFrog-Art-Api: "{{ lookup('env', 'MYTOKEN') }}" diff --git a/roles/websphere/tasks/configure.yml b/roles/websphere/tasks/configure.yml index 950b405..0c50118 100644 --- a/roles/websphere/tasks/configure.yml +++ b/roles/websphere/tasks/configure.yml @@ -1,7 +1,7 @@ --- -- name: Patch JspBatchCompiler +- name: Increase JspBatchCompiler Memory replace: - path: "{{ websphere_install_path }}/bin/JspBatchCompiler.{{ 'bat' if ansible_os_family == 'Windows' else 'sh' }}" + path: "{{ websphere_install_path }}/bin/JspBatchCompiler.sh" regexp: "-Xmx256m" replace: "-Xmx1024m" mode: 0755 diff --git a/roles/websphere/tasks/env.yml b/roles/websphere/tasks/env.yml index 897a253..d6f7f3f 100644 --- a/roles/websphere/tasks/env.yml +++ b/roles/websphere/tasks/env.yml @@ -4,7 +4,6 @@ path: "{{ profiled_path }}" mode: 0755 state: directory - when: ansible_os_family != "Windows" - name: "Create {{ profiled_path }}/websphere.sh" copy: @@ -21,7 +20,6 @@ J2EE_JAR=$WAS_HOME/lib/j2ee.jar export J2EE_JAR mode: 0755 - when: ansible_os_family != "Windows" - name: Create /opt/.profile copy: @@ -42,4 +40,3 @@ LANG=en_US.ISO-8859-1 umask 002 mode: 0755 - when: ansible_os_family != "Windows" diff --git a/roles/websphere/tasks/fixpack_install.yml b/roles/websphere/tasks/fixpack_install.yml index ce4193c..96aae56 100644 --- a/roles/websphere/tasks/fixpack_install.yml +++ b/roles/websphere/tasks/fixpack_install.yml @@ -1,4 +1,24 @@ --- +- name: Create zip directory + file: + path: /tmp/repo-zips + state: directory + +- name: Copy WAS repo + copy: + src: "{{ websphere_fp_path }}/{{ item }}" + dest: "/tmp/repo-zips/{{ item }}" + loop: "{{ websphere_fp_archive_list }}" + when: download_url is not defined + +- name: Download repo + get_url: + dest: "/tmp/repo-zips/{{ item }}" + url: "{{ download_url }}/{{ websphere_fp_path }}/{{ item }}" + headers: "{{ download_header }}" + loop: "{{ websphere_fp_archive_list }}" + when: download_url is defined + - name: Create repo directories file: path: /tmp/repo @@ -9,12 +29,20 @@ src: "/tmp/repo-zips/{{ item }}" dest: /tmp/repo remote_src: yes - loop: "{{ zip_list }}" + loop: "{{ websphere_fp_archive_list }}" - name: Install package iim_package: iim_path: "{{ iim_install_path }}" - product_id: "{{ pack_id }}" + product_id: "com.ibm.websphere.ND.{{ websphere_pid }}" path: "{{ websphere_install_path }}" repo: /tmp/repo state: present + +- name: Cleanup + file: + path: "{{ item }}" + state: absent + loop: + - /tmp/repo + - /tmp/repo-zips diff --git a/roles/websphere/tasks/main.yml b/roles/websphere/tasks/main.yml index ed97576..7919124 100644 --- a/roles/websphere/tasks/main.yml +++ b/roles/websphere/tasks/main.yml @@ -14,10 +14,6 @@ - name: Install Fixpack version include_tasks: fixpack_install.yml - vars: - zip_path: "{{ websphere_fp_path }}" - zip_list: "{{ websphere_fp_archive_list }}" - pack_id: "com.ibm.websphere.ND.{{ websphere_pid }}" when: not iim_info.exact_installed - name: Setup environment variables diff --git a/roles/websphere/tasks/v85_base_install.yml b/roles/websphere/tasks/v85_base_install.yml index c4035b1..afec8e9 100644 --- a/roles/websphere/tasks/v85_base_install.yml +++ b/roles/websphere/tasks/v85_base_install.yml @@ -1,10 +1,23 @@ --- -- name: Copy installers +- name: Create zip directory + file: + path: /tmp/repo-zips + state: directory + +- name: Copy WAS repo copy: - directory_mode: yes - remote_src: no - src: "/tmp/repo-zips/" - dest: "/tmp/repo-zips/" + src: "{{ websphere_base_path }}/{{ item }}" + dest: "/tmp/repo-zips/{{ item }}" + loop: "{{ websphere_base_archive_list }}" + when: download_url is not defined + +- name: Download WAS repo + get_url: + dest: "/tmp/repo-zips/{{ item }}" + url: "{{ download_url }}/{{ websphere_base_path }}/{{ item }}" + headers: "{{ download_header }}" + loop: "{{ websphere_base_archive_list }}" + when: download_url is defined - name: Create WAS repo directory file: @@ -24,8 +37,16 @@ - name: Install WAS iim_package: iim_path: "{{ iim_install_path }}" - product_id: com.ibm.websphere.ND.v85 + product_id: "{{ websphere_base_pid }}" path: "{{ websphere_install_path }}" repo: /tmp/repo state: present when: "iim_info.packages | select('match', 'com.ibm.websphere.ND.*') | list | length == 0" + +- name: Cleanup + file: + path: "{{ item }}" + state: absent + loop: + - /tmp/repo + - /tmp/repo-zips diff --git a/roles/websphere/tasks/v90_base_install.yml b/roles/websphere/tasks/v90_base_install.yml index 782a9ad..1bc1e78 100644 --- a/roles/websphere/tasks/v90_base_install.yml +++ b/roles/websphere/tasks/v90_base_install.yml @@ -1,17 +1,36 @@ --- -- name: Create temporary directory +- name: Create zip directory file: - path: /tmp/repo-zips/ - recurse: yes - mode: 0755 + path: /tmp/repo-zips state: directory -- name: Copy installers +- name: Copy WAS repo copy: - directory_mode: yes - remote_src: no - src: "/tmp/repo-zips/" - dest: "/tmp/repo-zips/" + src: "{{ websphere_base_path }}/{{ item }}" + dest: "/tmp/repo-zips/{{ item }}" + loop: "{{ websphere_base_archive_list }}" + when: download_url is not defined + +- name: Download WAS repo + get_url: + dest: "/tmp/repo-zips/{{ item }}" + url: "{{ download_url }}/{{ websphere_base_path }}/{{ item }}" + headers: "{{ download_header }}" + loop: "{{ websphere_base_archive_list }}" + when: download_url is defined + +- name: Copy Java repo + copy: + src: "{{ websphere_java_path }}" + dest: "/tmp/repo-zips/java-repo.zip" + when: download_url is not defined + +- name: Download Java repo + get_url: + url: "{{ download_url }}/{{ websphere_java_path }}" + dest: "/tmp/repo-zips/java-repo.zip" + headers: "{{ download_header }}" + when: download_url is defined - name: Create WAS repo directories file: @@ -54,9 +73,17 @@ iim_package: iim_path: "{{ iim_install_path }}" product_id: - - com.ibm.websphere.ND.v90 - - com.ibm.java.jdk.v8 + - "{{ websphere_base_pid }}" + - "{{ websphere_java_pid }}" path: "{{ websphere_install_path }}" repo: "{{ repo_list }}" state: present when: "iim_info.packages | select('match', 'com.ibm.websphere.ND.*') | list | length == 0" + +- name: Cleanup + file: + path: "{{ item }}" + state: absent + loop: + - /tmp/repo + - /tmp/repo-zips diff --git a/roles/websphere/vars/v8.5.5.17.yml b/roles/websphere/vars/v8.5.5.17.yml index 0491e56..87fda88 100644 --- a/roles/websphere/vars/v8.5.5.17.yml +++ b/roles/websphere/vars/v8.5.5.17.yml @@ -1,6 +1,7 @@ --- websphere_pid: v85_8.5.5017.20200205_1450 +websphere_base_pid: com.ibm.websphere.ND.v85 websphere_base_path: WAS/8.5.5ND websphere_base_archive_list: - WAS_ND_V8.5.5_1_OF_3.zip diff --git a/roles/websphere/vars/v9.0.5.3.yml b/roles/websphere/vars/v9.0.5.3.yml index 0736203..5eb051a 100644 --- a/roles/websphere/vars/v9.0.5.3.yml +++ b/roles/websphere/vars/v9.0.5.3.yml @@ -1,15 +1,17 @@ --- +# FP Vars websphere_pid: v90_9.0.5003.20200226_0941 +websphere_fp_path: WAS/9.0.5Fixpacks +websphere_fp_archive_list: + - 9.0.5-WS-WAS-FP003.zip +# Base Vars +websphere_base_pid: com.ibm.websphere.ND.v90 websphere_base_path: WAS/9.0.5ND websphere_base_archive_list: - was.repo.90500.nd.zip -websphere_java_path: Java/IBM -websphere_java_version: 8.0-6.15 +# Java Vars +websphere_java_path: Java/IBM/ibm-java-sdk-8.0-6.26-linux-x64-installmgr.zip websphere_java_pid: com.ibm.java.jdk.v8 websphere_java_home: java/8.0 - -websphere_fp_path: WAS/9.0.5Fixpacks -websphere_fp_archive_list: - - 9.0.5-WS-WAS-FP003.zip diff --git a/roles/websphere/vars/v9.0.5.7.yml b/roles/websphere/vars/v9.0.5.7.yml index 0555f85..ce7eb45 100644 --- a/roles/websphere/vars/v9.0.5.7.yml +++ b/roles/websphere/vars/v9.0.5.7.yml @@ -1,15 +1,17 @@ --- +# FP Vars websphere_pid: v90_9.0.5007.20210301_1241 +websphere_fp_path: WAS/9.0.5Fixpacks +websphere_fp_archive_list: + - 9.0.5-WS-WAS-FP007.zip +# Base Vars +websphere_base_pid: com.ibm.websphere.ND.v90 websphere_base_path: WAS/9.0.5ND websphere_base_archive_list: - was.repo.90500.nd.zip -websphere_java_path: Java/IBM -websphere_java_version: 8.0-6.26 +# Java Vars +websphere_java_path: Java/IBM/ibm-java-sdk-8.0-6.26-linux-x64-installmgr.zip websphere_java_pid: com.ibm.java.jdk.v8 websphere_java_home: java/8.0 - -websphere_fp_path: WAS/9.0.5Fixpacks -websphere_fp_archive_list: - - 9.0.5-WS-WAS-FP007.zip diff --git a/roles/websphere/vars/v9.0.5.8.yml b/roles/websphere/vars/v9.0.5.8.yml index a37dd54..946e6cd 100644 --- a/roles/websphere/vars/v9.0.5.8.yml +++ b/roles/websphere/vars/v9.0.5.8.yml @@ -1,15 +1,17 @@ --- +# FP Vars websphere_pid: v90_9.0.5008.20210525_1601 +websphere_fp_path: WAS/9.0.5Fixpacks +websphere_fp_archive_list: + - 9.0.5-WS-WAS-FP008.zip +# Base Vars +websphere_base_pid: com.ibm.websphere.ND.v90 websphere_base_path: WAS/9.0.5ND websphere_base_archive_list: - was.repo.90500.nd.zip -websphere_java_path: Java/IBM -websphere_java_version: 8.0-6.26 +# Java Vars +websphere_java_path: Java/IBM/ibm-java-sdk-8.0-6.26-linux-x64-installmgr.zip websphere_java_pid: com.ibm.java.jdk.v8 websphere_java_home: java/8.0 - -websphere_fp_path: WAS/9.0.5Fixpacks -websphere_fp_archive_list: - - 9.0.5-WS-WAS-FP008.zip diff --git a/scripts/downloadInstaller.sh b/scripts/downloadInstaller.sh index 49b8c1a..5de4e6d 100644 --- a/scripts/downloadInstaller.sh +++ b/scripts/downloadInstaller.sh @@ -5,37 +5,17 @@ if [ "$1" = "iim-191-centos-8" ]; then echo "Download IIM installer" mkdir -p /tmp/iim/ curl -H "X-JFrog-Art-Api: ${ARTIFACTORY_TOKEN}" -k ${ARTIFACTORY_URL}/${ARTIFACTORY_REPO}/SoftwareInstallers/IIM/agent.installer.linux.gtk.x86_64_1.9.1001.20191112_1525.zip -o /tmp/iim/iim_installer.tar.gz -fi - # Websphere -if [ "$1" = "websphere-v85-centos-7" ]; then +elif [ "$1" = "websphere-v85-centos-7" ]; then echo "Download IIM installer" mkdir -p /tmp/iim/ curl -H "X-JFrog-Art-Api: ${ARTIFACTORY_TOKEN}" -k ${ARTIFACTORY_URL}/${ARTIFACTORY_REPO}/SoftwareInstallers/IIM/agent.installer.linux.gtk.x86_64_1.9.1001.20191112_1525.zip -o /tmp/iim/iim_installer.tar.gz - echo "Download Websphere installer and fixpacks" - # base - mkdir -p /tmp/repo-zips/ - curl -H "X-JFrog-Art-Api: ${ARTIFACTORY_TOKEN}" -k ${ARTIFACTORY_URL}/${ARTIFACTORY_REPO}/SoftwareInstallers/WAS/8.5.5ND/WAS_ND_V8.5.5_1_OF_3.zip -o /tmp/repo-zips/WAS_ND_V8.5.5_1_OF_3.zip - curl -H "X-JFrog-Art-Api: ${ARTIFACTORY_TOKEN}" -k ${ARTIFACTORY_URL}/${ARTIFACTORY_REPO}/SoftwareInstallers/WAS/8.5.5ND/WAS_ND_V8.5.5_2_OF_3.zip -o /tmp/repo-zips/WAS_ND_V8.5.5_2_OF_3.zip - curl -H "X-JFrog-Art-Api: ${ARTIFACTORY_TOKEN}" -k ${ARTIFACTORY_URL}/${ARTIFACTORY_REPO}/SoftwareInstallers/WAS/8.5.5ND/WAS_ND_V8.5.5_3_OF_3.zip -o /tmp/repo-zips/WAS_ND_V8.5.5_3_OF_3.zip - # fixpacks - curl -H "X-JFrog-Art-Api: ${ARTIFACTORY_TOKEN}" -k ${ARTIFACTORY_URL}/${ARTIFACTORY_REPO}/SoftwareInstallers/WAS/8.5.5Fixpacks/FP17/8.5.5-WS-WAS-FP017-part1.zip -o /tmp/repo-zips/8.5.5-WS-WAS-FP017-part1.zip - curl -H "X-JFrog-Art-Api: ${ARTIFACTORY_TOKEN}" -k ${ARTIFACTORY_URL}/${ARTIFACTORY_REPO}/SoftwareInstallers/WAS/8.5.5Fixpacks/FP17/8.5.5-WS-WAS-FP017-part2.zip -o /tmp/repo-zips/8.5.5-WS-WAS-FP017-part2.zip - curl -H "X-JFrog-Art-Api: ${ARTIFACTORY_TOKEN}" -k ${ARTIFACTORY_URL}/${ARTIFACTORY_REPO}/SoftwareInstallers/WAS/8.5.5Fixpacks/FP17/8.5.5-WS-WAS-FP017-part3.zip -o /tmp/repo-zips/8.5.5-WS-WAS-FP017-part3.zip - elif [ "$1" = "websphere-v90-centos-8" ]; then echo "Download IIM installer" mkdir -p /tmp/iim/ curl -H "X-JFrog-Art-Api: ${ARTIFACTORY_TOKEN}" -k ${ARTIFACTORY_URL}/${ARTIFACTORY_REPO}/SoftwareInstallers/IIM/agent.installer.linux.gtk.x86_64_1.9.1001.20191112_1525.zip -o /tmp/iim/iim_installer.tar.gz - echo "Download Websphere installer and fixpacks" - mkdir -p /tmp/repo-zips/ - curl -H "X-JFrog-Art-Api: ${ARTIFACTORY_TOKEN}" -k ${ARTIFACTORY_URL}/${ARTIFACTORY_REPO}/SoftwareInstallers/WAS/9.0.5ND/was.repo.90500.nd.zip -o /tmp/repo-zips/was.repo.90500.nd.zip - # java - curl -H "X-JFrog-Art-Api: ${ARTIFACTORY_TOKEN}" -k ${ARTIFACTORY_URL}/${ARTIFACTORY_REPO}/SoftwareInstallers/Java/IBM/ibm-java-sdk-8.0-6.26-linux-x64-installmgr.zip -o /tmp/repo-zips/java-repo.zip - # fixpacks - curl -H "X-JFrog-Art-Api: ${ARTIFACTORY_TOKEN}" -k ${ARTIFACTORY_URL}/${ARTIFACTORY_REPO}/SoftwareInstallers/WAS/9.0.5Fixpacks/9.0.5-WS-WAS-FP008.zip -o /tmp/repo-zips/9.0.5-WS-WAS-FP008.zip elif [ "$1" = "ihs-v90-centos-8" ]; then echo "Download IIM installer"