Skip to content

Commit

Permalink
Add OHS role with remote download (#29)
Browse files Browse the repository at this point in the history
* Initial first pass cleaning and upload.

* Add OHS travis tests.

* Comment out weblogic dependancy to see how far the test gets

* Change order of tasks to make the check

* Add download vars

* Linter complaining about spaces

* Doh missed a bit in the path

* Need to add "OHS" to the path to the base installer also

* Doh add path element to the right place

* Remove unused var

* Opatch path incorrrect

* Increase swap size for OHS install to pass.

* linter

* Remove the following comment: 
# This is an example playbook to execute Ansible tests.

* Add Python imports to placate the python linter.

* Fox to readme.

* Python syntax error

* Remove unnecessary lint errors and update galaxy yml version

* Reintroduce Weblogic role into OHS.

* update by single digit

* Review comments

* Use consistent dest for OHS installer stuff and Java

* Update .travis.yml

* Update base_install.yml

* Update base_install.yml

* Update base_install.yml

* Revert "Update base_install.yml"

This reverts commit fae7564.

* Revert "Revert "Update base_install.yml""

This reverts commit e40c048.

* Revert "Revert "Revert "Update base_install.yml"""

This reverts commit 92d2e2b.

* disable travis, fix undefined var path for base install, test

* remove check and unused var

* Update base_install.yml

* fix patches filepaths

* Update base_install.yml

* fix patch paths

* Update patch.yml

* remove pointless verify

* tweak readme and clean comment

* uncomment travis file

* forgot to remove installer from the 12.1.3 verify as well

* fix copy tasks

* change repo.zip name to baseInstaller

Co-authored-by: martin-cummins <[email protected]>
Co-authored-by: martinccummins <[email protected]>
Co-authored-by: salob <[email protected]>
Co-authored-by: Roman Muntean <[email protected]>
  • Loading branch information
5 people authored Oct 22, 2021
1 parent a0f5b64 commit 6262b93
Show file tree
Hide file tree
Showing 29 changed files with 1,398 additions and 9 deletions.
11 changes: 11 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ cache:
before_cache:
- rm -f $HOME/.cache/pip/log/debug.log

before_install:
- sudo fallocate -l 4G /swapfile
- sudo chmod 600 /swapfile
- sudo mkswap /swapfile
- sudo swapon /swapfile
- sudo sysctl -w vm.swappiness=10
- sudo sysctl -w net.core.wmem_default=65536

install:
- pip install -r ci-requirements.txt
- curl -sLO https://github.com/mikefarah/yq/releases/download/3.4.0/yq_linux_amd64
Expand All @@ -41,6 +49,9 @@ env:
- SCENARIO=iim-191-centos-8
- SCENARIO=ihs-v90-centos-8
- SCENARIO=ihs-v80-centos-7
- SCENARIO=ohs-v12.2.1-centos-7
- SCENARIO=ohs-v12.2.1-centos-8
- SCENARIO=ohs-v12.1.3-centos-7
- SCENARIO=liberty-centos-7
- SCENARIO=liberty-centos-8
- SCENARIO=weblogic-centos-7
Expand Down
2 changes: 1 addition & 1 deletion galaxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace: ibm
name: spm_middleware

# The version of the collection. Must be compatible with semantic versioning
version: 1.1.1
version: 1.1.2

# The path to the Markdown (.md) readme file. This path is relative to the root of the collection
readme: README.md
Expand Down
2 changes: 0 additions & 2 deletions molecule/__ihs-v90/verify.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
---
# This is an example playbook to execute Ansible tests.

- name: Verify
hosts: all
pre_tasks:
Expand Down
45 changes: 45 additions & 0 deletions molecule/__ohs-v12.1.3/converge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
- name: Converge
hosts: all

collections:
- ibm.spm_middleware

tasks:
- name: Install python3
package:
name: python3
state: present

- name: Create symlink for python3
file:
src: /usr/bin/python3
dest: /usr/local/bin/python
owner: root
group: root
state: link

- name: pip self-update
pip:
name: pip
executable: pip3
state: latest
vars:
ansible_python_interpreter: /usr/bin/python3

- name: include weblogic
include_role:
name: weblogic
vars:
ansible_python_interpreter: /usr/bin/python3
weblogic_version: "12.1.3.0.210720"

- name: include ohs
include_role:
name: ohs
vars:
ansible_python_interpreter: /usr/bin/python3
ohs_version: 12.1.3.0.200412
vars:
download_url: "{{ lookup('env', 'ARTIFACTORY_URL') }}/{{ lookup('env', 'ARTIFACTORY_REPO') }}/SoftwareInstallers"
download_header: { 'X-JFrog-Art-Api': "{{ lookup('env', 'ARTIFACTORY_TOKEN') }}"}
51 changes: 51 additions & 0 deletions molecule/__ohs-v12.1.3/verify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
---
- name: Verify
hosts: all

pre_tasks:
- name: include vars
include_vars: "../../roles/ohs/vars/v12.1.3.0.200412.yml"

- name: include default
include_vars: "../../roles/ohs/defaults/main.yml"

- name: Check opatch version
shell: "grep {{ opatch_version }} {{ ohs_home }}/OPatch/version.txt"
ignore_errors: True
register: opatch_version_flag
when: opatch_version is defined

- name: Check Shell File Exists
stat:
path: "{{ profiled_path }}/ohs.sh"
register: shell

- name: Check Profile File Exists
stat:
path: /opt/.profile
register: profile

- name: Check Domain Created
shell: "grep ohs_{{ ansible_hostname }} {{ ohs_home }}/domain-registry.xml"
ignore_errors: True
register: domain_created
when: opatch_version is defined

tasks:
- name: Check Patch Number Matched
assert:
that: opatch_version_flag.rc == 0
when: opatch_version is defined

- name: Check that shell exists
assert:
that: shell.stat.exists

- name: Check that profile exists
assert:
that: profile.stat.exists

- name: Check Domain Created
assert:
that: domain_created.rc == 0
when: opatch_version is defined
44 changes: 44 additions & 0 deletions molecule/__ohs-v12.2.1/converge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
- name: Converge
hosts: all

collections:
- ibm.spm_middleware

tasks:
- name: Install python3
package:
name: python3
state: present

- name: Create symlink for python3
file:
src: /usr/bin/python3
dest: /usr/local/bin/python
owner: root
group: root
state: link

- name: pip self-update
pip:
name: pip
executable: pip3
state: latest
vars:
ansible_python_interpreter: /usr/bin/python3

- name: include weblogic
include_role:
name: weblogic
vars:
ansible_python_interpreter: /usr/bin/python3
weblogic_version: "12.1.3.0.210720"

- name: include ohs
include_role:
name: ohs
vars:
ansible_python_interpreter: /usr/bin/python3
vars:
download_url: "{{ lookup('env', 'ARTIFACTORY_URL') }}/{{ lookup('env', 'ARTIFACTORY_REPO') }}/SoftwareInstallers"
download_header: { 'X-JFrog-Art-Api': "{{ lookup('env', 'ARTIFACTORY_TOKEN') }}"}
51 changes: 51 additions & 0 deletions molecule/__ohs-v12.2.1/verify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
---
- name: Verify
hosts: all

pre_tasks:
- name: include vars
include_vars: "../../roles/ohs/vars/v12.2.1.4.210324.yml"

- name: include default
include_vars: "../../roles/ohs/defaults/main.yml"

- name: Check opatch version
shell: "grep {{ opatch_version }} {{ ohs_home }}/OPatch/version.txt"
ignore_errors: True
register: opatch_version_flag
when: opatch_version is defined

- name: Check Shell File Exists
stat:
path: "{{ profiled_path }}/ohs.sh"
register: shell

- name: Check Profile File Exists
stat:
path: /opt/.profile
register: profile

- name: Check Domain Created
shell: "grep ohs_{{ ansible_hostname }} {{ ohs_home }}/domain-registry.xml"
ignore_errors: True
register: domain_created
when: opatch_version is defined

tasks:
- name: Check Patch Number Matched
assert:
that: opatch_version_flag.rc == 0
when: opatch_version is defined

- name: Check that shell exists
assert:
that: shell.stat.exists

- name: Check that profile exists
assert:
that: profile.stat.exists

- name: Check Domain Created
assert:
that: domain_created.rc == 0
when: opatch_version is defined
2 changes: 0 additions & 2 deletions molecule/db2111/verify.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
---
# This is an example playbook to execute Ansible tests.

- name: Verify
hosts: all
pre_tasks:
Expand Down
2 changes: 0 additions & 2 deletions molecule/db2115/verify.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
---
# This is an example playbook to execute Ansible tests.

- name: Verify
hosts: all
pre_tasks:
Expand Down
2 changes: 0 additions & 2 deletions molecule/default/verify.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
---
# This is an example playbook to execute Ansible tests.

- name: Verify
hosts: all
pre_tasks:
Expand Down
34 changes: 34 additions & 0 deletions molecule/ohs-v12.1.3-centos-7/molecule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
driver:
name: docker
provider:
name: docker

lint: |
set -e
yamllint .
platforms:
- name: centos-7
image: centos:7
dockerfile: ../_resources/Dockerfile.j2
pre_build_image: False
privileged: True
volume_mounts:
- "/sys/fs/cgroup:/sys/fs/cgroup:rw"
command: "/usr/sbin/init"
environment:
container: docker

provisioner:
name: ansible
log: true
config_options:
defaults:
stderr_callback: debug
stdout_callback: debug
env:
ANSIBLE_FORCE_COLOR: 'true'
playbooks:
converge: ../__ohs-v12.1.3/converge.yml
verify: ../__ohs-v12.1.3/verify.yml
34 changes: 34 additions & 0 deletions molecule/ohs-v12.2.1-centos-7/molecule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
driver:
name: docker
provider:
name: docker

lint: |
set -e
yamllint .
platforms:
- name: centos-7
image: centos:7
dockerfile: ../_resources/Dockerfile.j2
pre_build_image: False
privileged: True
volume_mounts:
- "/sys/fs/cgroup:/sys/fs/cgroup:rw"
command: "/usr/sbin/init"
environment:
container: docker

provisioner:
name: ansible
log: true
config_options:
defaults:
stderr_callback: debug
stdout_callback: debug
env:
ANSIBLE_FORCE_COLOR: 'true'
playbooks:
converge: ../__ohs-v12.2.1/converge.yml
verify: ../__ohs-v12.2.1/verify.yml
34 changes: 34 additions & 0 deletions molecule/ohs-v12.2.1-centos-8/molecule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
driver:
name: docker
provider:
name: docker

lint: |
set -e
yamllint .
platforms:
- name: centos-8
image: centos:8
dockerfile: ../_resources/Dockerfile.j2
pre_build_image: False
privileged: True
volume_mounts:
- "/sys/fs/cgroup:/sys/fs/cgroup:rw"
command: "/usr/sbin/init"
environment:
container: docker

provisioner:
name: ansible
log: true
config_options:
defaults:
stderr_callback: debug
stdout_callback: debug
env:
ANSIBLE_FORCE_COLOR: 'true'
playbooks:
converge: ../__ohs-v12.2.1/converge.yml
verify: ../__ohs-v12.2.1/verify.yml
Loading

0 comments on commit 6262b93

Please sign in to comment.