Skip to content

Commit

Permalink
Download alternative option to copy (#15)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
salob authored Oct 11, 2021
1 parent a9bdf08 commit 40738df
Show file tree
Hide file tree
Showing 17 changed files with 73 additions and 58 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ env:
matrix:
- SCENARIO=websphere-v90-centos-8
- SCENARIO=websphere-v85-centos-7
- SCENARIO=db2-111-centos-7
- SCENARIO=db2-115-centos-8
- SCENARIO=db2111
- SCENARIO=db2115
- SCENARIO=iim-191-centos-8
- SCENARIO=iim-191-centos-8
- SCENARIO=ihs-v90-centos-8
Expand Down
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM docker:dind

RUN apk add --no-cache bash \
RUN apk update && apk add --no-cache bash \
py3-pip \
gcc \
libvirt \
Expand Down Expand Up @@ -36,6 +36,7 @@ RUN apk add --no-cache bash \
py3-urllib3 \
py3-virtualenv \
py3-websocket-client \
docker-compose \
&& rm -rf /var/cache/apk/* \
&& pip install --upgrade pip \
&& pip install --upgrade setuptools
Expand Down
12 changes: 0 additions & 12 deletions molecule/db2-111-centos-7/converge.yml

This file was deleted.

12 changes: 0 additions & 12 deletions molecule/db2-115-centos-8/converge.yml

This file was deleted.

14 changes: 14 additions & 0 deletions molecule/db2111/converge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
- name: Converge
hosts: all

collections:
- ibm.spm_middleware

roles:
- db2

vars:
db2_version: "11.1.4.6"
download_url: "{{ lookup('env', 'ARTIFACTORY_URL') }}/{{ lookup('env', 'ARTIFACTORY_REPO') }}/SoftwareInstallers"
download_header: { 'X-JFrog-Art-Api': "{{ lookup('env', 'ARTIFACTORY_TOKEN') }}"}
File renamed without changes.
File renamed without changes.
14 changes: 14 additions & 0 deletions molecule/db2115/converge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
- name: Converge
hosts: all

collections:
- ibm.spm_middleware

roles:
- db2

vars:
db2_version: "11.5.5.0"
download_url: "{{ lookup('env', 'ARTIFACTORY_URL') }}/{{ lookup('env', 'ARTIFACTORY_REPO') }}/SoftwareInstallers"
download_header: { 'X-JFrog-Art-Api': "{{ lookup('env', 'ARTIFACTORY_TOKEN') }}"}
File renamed without changes.
File renamed without changes.
14 changes: 10 additions & 4 deletions roles/db2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ The `db2` role will install IBM Db2.

## Role Variables

Ensure you update / override password variables prior to using the role.

| Property Name | Default value |
| ------------------------- | --------------------------------------------------- |
| `db2_install_path` | `/opt/IBM/db2` |
Expand All @@ -17,15 +19,19 @@ The `db2` role will install IBM Db2.
| ------------------------- | --------------------------------------------------- |
| `db2_db_create` | `True` |
| `db2_db_name` | `DATABASE` |
| `db2_db_username` | Environment variable: `DB2_USER` |
| `db2_db_password` | Environment variable: `DB2_PASSWORD` |
| `db2_db_spm_enc` | Environment variable: `DB2_ENC_PASSWORD` |
| `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` |
| ------------------------- | --------------------------------------------------- |


## Dependencies

Expand All @@ -37,7 +43,7 @@ None
- hosts: servers
roles:
- role: ibm.spm_middleware.db2
db2_version: 11.1.4.6
db2_version: 11.5.5.0
```

## License
Expand Down
11 changes: 6 additions & 5 deletions roles/db2/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,12 @@ db2_version: 11.1.4.6
db2_product: DB2_SERVER_EDITION
db2_bypass_prereq_check: false
db2_activate: True
db2_installer_path: /tmp/db2/db2_installer.tar.gz
db2_license_path: /tmp/db2ese_u.lic

db2_db_create: True
db2_db_name: DATABASE
db2_db_username: "{{ lookup('env', 'DB2_USER') }}"
db2_db_password: "{{ lookup('env', 'DB2_PASSWORD') }}"
db2_db_spm_enc: "{{ lookup('env', 'DB2_ENC_PASSWORD') }}"
db2_db_username: db2admin
db2_db_password: db2admin
db2_db_spm_enc: dummyPassword
db2_db_drop_required: False

bootstrap_dateformat: 'dd MM yyyy'
Expand All @@ -20,3 +18,6 @@ bootstrap_dmx_locale: 'en_US'

# Common
profiled_path: /opt/profile.d
# Server info for downloading installers / licenses directly, leave blank to copy
download_url: # e.g. https://artifactory/repo
download_header: # e.g. X-JFrog-Art-Api: "{{ lookup('env', 'MYTOKEN') }}"
10 changes: 10 additions & 0 deletions roles/db2/tasks/activate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@
copy:
src: "{{ db2_license_path }}"
dest: /tmp/db2/db2server.lic
when: download_url is not defined
register: target_lic_file

- name: Download license to target
get_url:
url: "{{ download_url }}/{{ db2_license_path }}"
dest: /tmp/db2server.lic
headers:
"{{ download_header }}"
when: download_url is defined
register: target_lic_file

- name: Apply license
Expand Down
9 changes: 9 additions & 0 deletions roles/db2/tasks/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@
copy:
src: "{{ db2_installer_path }}"
dest: "{{ tmp_dir.path }}/db2_installer.tar.gz"
when: download_url is not defined
register: db2_installer

- name: Download installer
get_url:
url: "{{ download_url }}/{{ db2_installer_path }}"
dest: "{{ tmp_dir.path }}/db2_installer.tar.gz"
headers: "{{ download_header }}"
when: download_url is defined
register: db2_installer

- name: Create tmp directory
Expand Down
5 changes: 3 additions & 2 deletions roles/db2/vars/v11.1.4.6.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
db2_zip_path: DB2/11.1/v11.1.4fp6_linuxx64_universal_fixpack.tar.gz
db2_lic_url: DB2/11.1/db2ese_u.lic
# paths can be relative to download_url or local
db2_installer_path: DB2/11.1/v11.1.4fp6_linuxx64_universal_fixpack.tar.gz
db2_license_path: DB2/11.1/db2ese_u.lic
5 changes: 3 additions & 2 deletions roles/db2/vars/v11.5.5.0.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
db2_zip_path: DB2/11.5/v11.5.5fp0_linuxx64_universal_fixpack.tar.gz
db2_lic_url: DB2/11.5/db2ese_u.lic
# paths can be relative to download_url or local
db2_installer_path: DB2/11.5/v11.5.5fp0_linuxx64_universal_fixpack.tar.gz
db2_license_path: DB2/11.5/db2ese_u.lic
18 changes: 0 additions & 18 deletions scripts/downloadInstaller.sh
Original file line number Diff line number Diff line change
@@ -1,23 +1,5 @@
#!/bin/bash
echo service is $1
# DB2
if [ "$1" = "default" ]; then
echo db2111
mkdir -p /tmp/db2/
curl -H "X-JFrog-Art-Api: ${ARTIFACTORY_TOKEN}" -k ${ARTIFACTORY_URL}/${ARTIFACTORY_REPO}/SoftwareInstallers/DB2/11.1/v11.1.4fp6_linuxx64_universal_fixpack.tar.gz -o /tmp/db2/db2_installer.tar.gz
curl -H "X-JFrog-Art-Api: ${ARTIFACTORY_TOKEN}" -k ${ARTIFACTORY_URL}/${ARTIFACTORY_REPO}/SoftwareInstallers/DB2/11.1/db2ese_u.lic -o /tmp/db2ese_u.lic
elif [ "$1" = "db2-111-centos-7" ]; then
echo db2111
mkdir -p /tmp/db2/
curl -H "X-JFrog-Art-Api: ${ARTIFACTORY_TOKEN}" -k ${ARTIFACTORY_URL}/${ARTIFACTORY_REPO}/SoftwareInstallers/DB2/11.1/v11.1.4fp6_linuxx64_universal_fixpack.tar.gz -o /tmp/db2/db2_installer.tar.gz
curl -H "X-JFrog-Art-Api: ${ARTIFACTORY_TOKEN}" -k ${ARTIFACTORY_URL}/${ARTIFACTORY_REPO}/SoftwareInstallers/DB2/11.1/db2ese_u.lic -o /tmp/db2ese_u.lic
elif [ "$1" = "db2-115-centos-8" ]; then
echo db2115
mkdir -p /tmp/db2/
curl -H "X-JFrog-Art-Api: ${ARTIFACTORY_TOKEN}" -k ${ARTIFACTORY_URL}/${ARTIFACTORY_REPO}/SoftwareInstallers/DB2/11.5/v11.5.5fp0_linuxx64_universal_fixpack.tar.gz -o /tmp/db2/db2_installer.tar.gz
curl -H "X-JFrog-Art-Api: ${ARTIFACTORY_TOKEN}" -k ${ARTIFACTORY_URL}/${ARTIFACTORY_REPO}/SoftwareInstallers/DB2/11.5/db2ese_u.lic -o /tmp/db2ese_u.lic
fi

# IIM
if [ "$1" = "iim-191-centos-8" ]; then
echo "Download IIM installer"
Expand Down

0 comments on commit 40738df

Please sign in to comment.