Skip to content

Commit

Permalink
IHS - Optional Download ( alternative to copy ) (#21)
Browse files Browse the repository at this point in the history
* Commit initial changes.

* Doh copy paste error.

* Mixed up var names.

* Remove download from download installer shell script.

* Leave iim in for now.

* Add tasks for FPs too.

* Add missing quotes

* More missing quotes

* Correct new var name

* Copy paste error

* v90 needs Java too

* Missing quotes

* Var name was wrong

* Fix pack caopy fix

* Missing quotes again?

* I forgot the when condition

* Lint issue

* Update var name

* Readme, galaxy version and one var name

* Copy paste error

* Another wrong var name

* Var used in the wrong place.

* Refactor to make copy clearer and fix up readme etc.

* Update src paths so they are the same if downloaded from artifactory or if already downloaded.

Co-authored-by: martin-cummins <[email protected]>
Co-authored-by: salob <[email protected]>
  • Loading branch information
3 people authored Oct 13, 2021
1 parent eb76cde commit bdf93f5
Show file tree
Hide file tree
Showing 15 changed files with 139 additions and 105 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ before_script:
script:
# Ansible Molecule tests
- chmod +x ./scripts/*
- ./scripts/downloadInstaller.sh $SCENARIO
- molecule test -s $SCENARIO

jobs:
include:
- stage: Ansible Tests
Expand Down
2 changes: 1 addition & 1 deletion molecule/__ihs-v90/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
hosts: all

collections:
- wh_spm.middleware
- ibm.spm_middleware

vars:
ihs_version: 9.0.5.8
Expand Down
41 changes: 14 additions & 27 deletions roles/ihs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ The `ihs` role will install IBM HTTP Server.
IBM Installation Manager (1.9.x) must already be installed in the target environment.

## Role Variables

NOTE: ihs_admin_pass should be changed after first installation.
| Property Name | Default value |
| ----------------------- | --------------------------------------------------- |
| `ihs_install_path` | `/opt/IBM/HTTPServer` |
Expand All @@ -20,55 +20,42 @@ IBM Installation Manager (1.9.x) must already be installed in the target environ
| ----------------------- | --------------------------------------------------- |
| Version-specific: | Values from `9.0.5.8` |
| ----------------------- | --------------------------------------------------- |
| `ihs_base_path` | `WAS/9.0.5ND` |
| `ihs_base_archive_list` | `was.repo.90500.[ihs|plugins|wct].zip` |
| `ihs_fp_path` | `WAS/9.0.5Fixpacks` |
| `ihs_fp_archive_list` | `9.0.5-WS-[IHSPLG|WCT]-FP008.zip` |
| `ihs_installer_archive_list` | `was.repo.90500.[ihs|plugins|wct].zip` |
| `ihs_fp_installer_path` | `WAS/9.0.5Fixpacks` |
| `ihs_fp_installer_archive_list` | `9.0.5-WS-[IHSPLG|WCT]-FP008.zip` |
| `ihs_pid` | `v90_9.0.5008.20210525_1601` |
| `ihs_java_zip_path` | `Java/IBM/ibm-java-sdk-8.0-6.26-linux-x64-installmgr.zip` |
| `ihs_java_pid` | `com.ibm.java.jdk.v8` |
| ----------------------- | --------------------------------------------------- |
| `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

IBM Installation Manager (iim)

ibm.spm_middleware.iim

## Example Playbook

```
---
- hosts: servers
remote_user: root
collections:
- ibm.spm_middleware
roles:
- ibm.spm_middleware.iim
- role: ibm.spm_middleware.ihs
vars:
- ihs_version: 8.5.5.17
```

## Example Playbook (Local Development)
```
---
- hosts: servers
remote_user: root
- name: Deploy IHS
hosts: all
collections:
- ibm.spm_middleware
roles:
- ibm.spm_middleware.iim
- role: ihs
- ibm.spm_middleware.ihs
vars:
- ihs_version: 8.5.5.17
- download_url: "https://myserver.com/IHS/repos"
- download_header: { 'Authorization': 'Basic EncodedString'}
```

## License
Expand Down
4 changes: 4 additions & 0 deletions roles/ihs/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,7 @@ ihs_admin_pass: wasadmin

# 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') }}"
21 changes: 16 additions & 5 deletions roles/ihs/tasks/v85_base_install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,25 @@
- name: Create zip directory
file:
path: /tmp/repo-zips
mode: 0755
state: directory
register: installer_dir

- name: Copy installers
- name: Download IHS installers
get_url:
dest: "{{ installer_dir.path }}/{{ item }}"
url: "{{ download_url }}/{{ ihs_installer_path }}/{{ item }}"
headers: "{{ download_header }}"
loop: "{{ ihs_installer_archive_list }}"
when: download_url is defined

- name: Copy base installers
copy:
directory_mode: yes
remote_src: no
src: "/tmp/repo-zips/"
dest: "/tmp/repo-zips/"
src: "{{ ihs_installer_path }}/"
dest: "{{ installer_dir.path }}/"
when: download_url is not defined

- name: Create IHS repo directories
file:
Expand All @@ -18,11 +29,11 @@

- name: Extract IHS installers
unarchive:
src: "/tmp/repo-zips/{{ item }}"
src: "{{ installer_dir.path }}/{{ item }}"
dest: /tmp/repo/
remote_src: yes
creates: "/tmp/repo/disk{{ (index + 1) | string }}"
loop: "{{ ihs_base_archive_list }}"
loop: "{{ ihs_installer_archive_list }}"
loop_control:
index_var: index

Expand Down
44 changes: 38 additions & 6 deletions roles/ihs/tasks/v85_fixpack_install.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,42 @@
---
- name: Create zip directory
file:
path: /tmp/repo-zips
mode: 0755
state: directory
register: installer_dir

- name: Download IHS Fix Pack installers
get_url:
dest: "{{ installer_dir.path }}/{{ item }}"
url: "{{ download_url }}/{{ ihs_fp_installer_path }}/{{ item }}"
headers: "{{ download_header }}"
loop: "{{ ihs_fp_installer_archive_list }}"
when: download_url is defined

- name: Download IHS repo
get_url:
dest: "{{ installer_dir.path }}/{{ item }}"
url: "{{ download_url }}/{{ ihs_fp_installer_path }}/{{ item }}"
headers: "{{ download_header }}"
loop: "{{ ihs_fp_installer_archive_list }}"
when: download_url is defined

- name: Download WCT repo
get_url:
dest: "{{ installer_dir.path }}/{{ item }}"
url: "{{ download_url }}/{{ ihs_fp_installer_path }}/{{ item }}"
headers: "{{ download_header }}"
loop: "{{ ihs_wct_installer_list }}"
when: download_url is defined

- name: Copy installers
copy:
directory_mode: yes
remote_src: no
src: "/tmp/repo-zips/"
dest: "/tmp/repo-zips/"
src: "{{ ihs_fp_installer_path }}"
dest: "{{ installer_dir.path }}"
when: download_url is not defined

- name: Create WAS repo directory
file:
Expand All @@ -18,17 +50,17 @@

- name: Extract IHS installers
unarchive:
src: "/tmp/repo-zips/{{ item }}"
src: "{{ installer_dir.path }}/{{ item }}"
dest: "/tmp/fp/"
remote_src: yes
loop: "{{ ihs_fp_archive_list }}"
loop: "{{ ihs_fp_installer_archive_list }}"

- name: Extract WCT installers
unarchive:
src: "/tmp/repo-zips/{{ item }}"
src: "{{ installer_dir.path }}/{{ item }}"
dest: "/tmp/wct/"
remote_src: yes
loop: "{{ ihs_wct_archive_list }}"
loop: "{{ ihs_wct_installer_list }}"

- name: Set up-to-date facts
set_fact:
Expand Down
32 changes: 25 additions & 7 deletions roles/ihs/tasks/v90_base_install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,49 +2,67 @@
- name: Create zip directory
file:
path: /tmp/repo-zips
mode: 0755
state: directory
register: installer_dir

- name: Download IHS installers
get_url:
dest: "{{ installer_dir.path }}/{{ item }}"
url: "{{ download_url }}/{{ ihs_installer_path }}/{{ item }}"
headers: "{{ download_header }}"
loop: "{{ ihs_installer_archive_list }}"
when: download_url is defined

- name: Copy base installers
copy:
directory_mode: yes
remote_src: no
src: "/tmp/repo-zips/"
dest: "/tmp/repo-zips/"
src: "{{ ihs_installer_path }}/"
dest: "{{ installer_dir.path }}/"
when: download_url is not defined

- name: Create IHS base repo directories
file:
path: "/tmp/repo/{{ index }}"
state: directory
loop: "{{ ihs_base_archive_list }}"
loop: "{{ ihs_installer_archive_list }}"
loop_control:
index_var: index

- name: Download Java repo
get_url:
dest: "{{ installer_dir.path }}/java-repo.zip"
url: "{{ download_url }}/{{ ihs_java_zip_path }}"
headers: "{{ download_header }}"
when: download_url is defined

- name: Create Java repo directory
file:
path: /tmp/repo/java
state: directory

- name: Extract IHS base installers
unarchive:
src: "/tmp/repo-zips/{{ item }}"
src: "{{ installer_dir.path }}/{{ item }}"
dest: "/tmp/repo/{{ index }}"
remote_src: yes
creates: "/tmp/repo/{{ index }}/repository.config"
loop: "{{ ihs_base_archive_list }}"
loop: "{{ ihs_installer_archive_list }}"
loop_control:
index_var: index

- name: Extract Java installer
unarchive:
src: /tmp/repo-zips/java-repo.zip
src: "{{ installer_dir.path }}/java-repo.zip"
dest: /tmp/repo/java
remote_src: yes
creates: /tmp/repo/java/repository.config

- name: Build base repo list
set_fact:
repo_list: "{{ repo_list | default(['/tmp/repo/java']) + ['/tmp/repo/' + index|string]}}"
loop: "{{ ihs_base_archive_list }}"
loop: "{{ ihs_installer_archive_list }}"
loop_control:
index_var: index

Expand Down
28 changes: 22 additions & 6 deletions roles/ihs/tasks/v90_fixpack_install.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,48 @@
---
- name: Create zip directory
file:
path: /tmp/repo-zips
mode: 0755
state: directory
register: installer_dir

- name: Create IHS fixpack repo directories
file:
path: "/tmp/repo/{{ index }}"
state: directory
loop: "{{ ihs_fp_archive_list }}"
loop: "{{ ihs_fp_installer_archive_list }}"
loop_control:
index_var: index

- name: Download IHS Fix Pack repo
get_url:
dest: "{{ installer_dir.path }}{{ item }}"
url: "{{ download_url }}/{{ ihs_fp_installer_path }}/{{ item }}"
headers: "{{ download_header }}"
loop: "{{ ihs_fp_installer_archive_list }}"
when: download_url is defined

- name: Copy fixpack installers
copy:
directory_mode: yes
remote_src: no
src: "/tmp/repo-zips/"
dest: "/tmp/repo-zips/"
src: "{{ ihs_fp_installer_path }}"
dest: "{{ installer_dir.path }}"
when: download_url is not defined

- name: Extract IHS fixpack installers
unarchive:
src: "/tmp/repo-zips/{{ item }}"
src: "{{ installer_dir.path }}{{ item }}"
dest: "/tmp/repo/{{ index }}"
remote_src: yes
loop: "{{ ihs_fp_archive_list }}"
loop: "{{ ihs_fp_installer_archive_list }}"
loop_control:
index_var: index

- name: Build fixpack repo list
set_fact:
repo_list: "{{ repo_list | default([]) + ['/tmp/repo/' + index|string]}}"
loop: "{{ ihs_fp_archive_list }}"
loop: "{{ ihs_fp_installer_archive_list }}"
loop_control:
index_var: index

Expand Down
10 changes: 5 additions & 5 deletions roles/ihs/vars/v8.5.5.17.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
---
ihs_base_path: WAS/8.5.5ND
ihs_base_archive_list:
ihs_installer_path: WAS/8.5.5ND
ihs_installer_archive_list:
- WAS_V8.5.5_SUPPL_1_OF_3.zip
- WAS_V8.5.5_SUPPL_2_OF_3.zip
- WAS_V8.5.5_SUPPL_3_OF_3.zip

ihs_fp_path: WAS/8.5.5Fixpacks/FP17
ihs_fp_archive_list:
ihs_fp_installer_path: WAS/8.5.5Fixpacks/FP17
ihs_fp_installer_archive_list:
- 8.5.5-WS-WASSupplements-FP017-part1.zip
- 8.5.5-WS-WASSupplements-FP017-part2.zip
- 8.5.5-WS-WASSupplements-FP017-part3.zip

ihs_wct_archive_list:
ihs_wct_installer_list:
- 8.5.5-WS-WCT-FP017-part1.zip
- 8.5.5-WS-WCT-FP017-part2.zip

Expand Down
8 changes: 4 additions & 4 deletions roles/ihs/vars/v9.0.5.3.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
---
ihs_base_path: WAS/9.0.5ND
ihs_base_archive_list:
ihs_installer_path: WAS/9.0.5ND
ihs_installer_archive_list:
- was.repo.90500.ihs.zip
- was.repo.90500.plugins.zip
- was.repo.90500.wct.zip

ihs_fp_path: WAS/9.0.5Fixpacks
ihs_fp_archive_list:
ihs_fp_installer_path: WAS/9.0.5Fixpacks
ihs_fp_installer_archive_list:
- 9.0.5-WS-IHSPLG-FP003.zip
- 9.0.5-WS-WCT-FP003.zip

Expand Down
Loading

0 comments on commit bdf93f5

Please sign in to comment.