Skip to content

Commit

Permalink
Weblogic (#23)
Browse files Browse the repository at this point in the history
* weblogic

* add weblogic scenario

* inc galaxy yaml version

* after review

* remove artifactory_url

* remove artifactory_url

* update vars

* after review and test

* remove unnecessary var

Co-authored-by: root <[email protected]>
Co-authored-by: salob <[email protected]>
  • Loading branch information
3 people authored Oct 14, 2021
1 parent bdf93f5 commit 93b49c8
Show file tree
Hide file tree
Showing 29 changed files with 905 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ env:
- SCENARIO=iim-191-centos-8
- SCENARIO=ihs-v90-centos-8
- SCENARIO=ihs-v80-centos-7
- SCENARIO=weblogic-centos-7
- SCENARIO=weblogic-centos-8
stage: Molecule Tests

before_script:
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.0.8
version: 1.0.9

# The path to the Markdown (.md) readme file. This path is relative to the root of the collection
readme: README.md
Expand Down
14 changes: 14 additions & 0 deletions molecule/__weblogic-v12.1/converge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
- name: Converge
hosts: all

collections:
- ibm.spm_middleware

vars:
weblogic_version: "12.1.3.0.210720"
# weblogic_installer_path: /opt/IBM/weblogic/WLS
download_url: "{{ lookup('env','ARTIFACTORY_URL') }}/{{ lookup('env','ARTIFACTORY_REPO') }}/SoftwareInstallers"
download_header: {'X-JFrog-Art-Api': "{{ lookup('env','ARTIFACTORY_TOKEN' )}}"}
roles:
- weblogic
45 changes: 45 additions & 0 deletions molecule/__weblogic-v12.1/verify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
- name: Verify
hosts: all
pre_tasks:
- name: include defaults
include_vars: "../../roles/weblogic/defaults/main.yml"
- name: include vars
include_vars: "../../roles/weblogic/vars/v12.1.3.0.210720.yml"
- stat:
path: /opt/Props/AppServer.properties
register: boot_props
- name: Slurp profile.d
slurp:
src: /opt/profile.d/weblogic.sh
register: env_oracle_sh
- name: Slurp registry.xml
slurp:
src: /home/oracle/Oracle/Middleware/Oracle_Home/inventory/registry.xml
register: registry_xml
- name: Check OPatch version
shell: "grep {{ opatch_version }} {{ weblogic_home }}/OPatch/version.txt"
ignore_errors: True
register: opatch_version_flag
when: opatch_version is defined
- name: Check if patched with correct patch
become: yes
become_user: "{{ weblogic_user }}"
shell: "{{ weblogic_home }}/OPatch/opatch lspatches | grep -i {{ patch_number }}"
changed_when: False
when: patch_number is defined

tasks:
- name: Check that AppServer.properties exists
assert:
that: boot_props.stat.exists
- name: Check that environment file has been created correctly
assert:
that: "{{ 'MW_HOME=/home/oracle/Oracle/Middleware/Oracle_Home' in (env_oracle_sh['content'] | b64decode) }}"
- name: Check Weblogic Installed
assert:
that: "{{ 'distribution status=\"installed\" name=\"WebLogic Server\"' in (registry_xml['content'] | b64decode) }}"
- name: Check OPatch version
assert:
that: opatch_version_flag.rc == 0
when: opatch_version is defined
14 changes: 14 additions & 0 deletions molecule/__weblogic-v12.2/converge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
- name: Converge
hosts: all

collections:
- ibm.spm_middleware

vars:
weblogic_version: "12.2.1.4.210716"
# weblogic_installer_path: /opt/IBM/weblogic/WLS
download_url: "{{ lookup('env','ARTIFACTORY_URL') }}/{{ lookup('env','ARTIFACTORY_REPO') }}/SoftwareInstallers"
download_header: {'X-JFrog-Art-Api': "{{ lookup('env','ARTIFACTORY_TOKEN' )}}"}
roles:
- weblogic
45 changes: 45 additions & 0 deletions molecule/__weblogic-v12.2/verify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
- name: Verify
hosts: all
pre_tasks:
- name: include defaults
include_vars: "../../roles/weblogic/defaults/main.yml"
- name: include vars
include_vars: "../../roles/weblogic/vars/v12.2.1.4.210716.yml"
- stat:
path: /opt/Props/AppServer.properties
register: boot_props
- name: Slurp profile.d
slurp:
src: /opt/profile.d/weblogic.sh
register: env_oracle_sh
- name: Slurp registry.xml
slurp:
src: /home/oracle/Oracle/Middleware/Oracle_Home/inventory/registry.xml
register: registry_xml
- name: Check OPatch version
shell: "grep {{ opatch_version }} {{ weblogic_home }}/OPatch/version.txt"
ignore_errors: True
register: opatch_version_flag
when: opatch_version is defined
- name: Check if patched with correct patch
become: yes
become_user: "{{ weblogic_user }}"
shell: "{{ weblogic_home }}/OPatch/opatch lspatches | grep -i {{ patch_number }}"
changed_when: False
when: patch_number is defined

tasks:
- name: Check that AppServer.properties exists
assert:
that: boot_props.stat.exists
- name: Check that environment file has been created correctly
assert:
that: "{{ 'MW_HOME=/home/oracle/Oracle/Middleware/Oracle_Home' in (env_oracle_sh['content'] | b64decode) }}"
- name: Check Weblogic Installed
assert:
that: "{{ 'distribution status=\"installed\" name=\"WebLogic Server\"' in (registry_xml['content'] | b64decode) }}"
- name: Check OPatch version
assert:
that: opatch_version_flag.rc == 0
when: opatch_version is defined
14 changes: 14 additions & 0 deletions molecule/__weblogic-v14.1/converge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
- name: Converge
hosts: all

collections:
- ibm.spm_middleware

vars:
weblogic_version: "14.1.1.0.210716"
# weblogic_installer_path: /opt/IBM/weblogic/WLS
download_url: "{{ lookup('env','ARTIFACTORY_URL') }}/{{ lookup('env','ARTIFACTORY_REPO') }}/SoftwareInstallers"
download_header: {'X-JFrog-Art-Api': "{{ lookup('env','ARTIFACTORY_TOKEN' )}}"}
roles:
- weblogic
44 changes: 44 additions & 0 deletions molecule/__weblogic-v14.1/verify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
- name: Verify
hosts: all
pre_tasks:
- name: include defaults
include_vars: "../../roles/weblogic/defaults/main.yml"
- name: include vars
include_vars: "../../roles/weblogic/vars/v14.1.1.0.210716.yml"
- stat:
path: /opt/Props/AppServer.properties
register: boot_props
- name: Slurp profile.d
slurp:
src: /opt/profile.d/weblogic.sh
register: env_oracle_sh
- name: Slurp registry.xml
slurp:
src: /home/oracle/Oracle/Middleware/Oracle_Home/inventory/registry.xml
register: registry_xml
- name: Check OPatch version
shell: "grep {{ opatch_version }} {{ weblogic_home }}/OPatch/version.txt"
ignore_errors: True
register: opatch_version_flag
when: opatch_version is defined
- name: Check if patched with correct patch
become: yes
become_user: "{{ weblogic_user }}"
shell: "{{ weblogic_home }}/OPatch/opatch lspatches | grep -i {{ patch_number }}"
changed_when: False
when: patch_number is defined
tasks:
- name: Check that AppServer.properties exists
assert:
that: boot_props.stat.exists
- name: Check that environment file has been created correctly
assert:
that: "{{ 'MW_HOME=/home/oracle/Oracle/Middleware/Oracle_Home' in (env_oracle_sh['content'] | b64decode) }}"
- name: Check Weblogic Installed
assert:
that: "{{ 'distribution status=\"installed\" name=\"WebLogic Server\"' in (registry_xml['content'] | b64decode) }}"
- name: Check OPatch version
assert:
that: opatch_version_flag.rc == 0
when: opatch_version is defined
34 changes: 34 additions & 0 deletions molecule/weblogic-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: ../__weblogic-v12.1/converge.yml
verify: ../__weblogic-v12.1/verify.yml
34 changes: 34 additions & 0 deletions molecule/weblogic-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: ../__weblogic-v14.1/converge.yml
verify: ../__weblogic-v14.1/verify.yml
62 changes: 62 additions & 0 deletions roles/weblogic/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Weblogic

The `weblogc` role will install Weblogic.

## Requirements

* CentOS-7/8, Redhat 7.x/8.x

## Role Variables

| Property Name | Default value |
| ------------------------- | --------------------------------------------------- |
| `weblogic_base` | `/home/oracle` |
| `weblogic_home` | `/home/oracle/Oracle/Middleware/Oracle_Home` |
| `server_port` | `7001` |
| `download_url` | # Set this if license and installer is being downloaded from a http server|
| `download_header` | # Use this in conjunction with `download_url` |
| `weblogic_installer_path` | Controller local path or relative to download_url |
| `weblogic_patch_path` | Controller local path or relative to download_url |
| `java_zip_path` | Controller local path or relative to download_url |

| ------------------------- | --------------------------------------------------- |
| ** `weblogic_version` ** | `12.1.3.0.2` |
| | `12.1.3.0.210720` |
| | `12.2.1.4.210716` |
| | `14.1.1.0.210716` |

...

## Dependencies

Download WebLogic Server Installation packages and patch packages, and upload it to: wh-spmdevops-generic-local/SoftwareInstallers/WLS/ .

## Example Playbook

The following explains the structure of this role.
tasks/main.yml
- defaults/main.yml vars file is included (default weblogic_version is '14.1.1.0.210716' if no alternative is passed in with your ansible-playbook command)
- runs: prereqs.yml
- runs: install.yml
- runs: patch.yml

If the version specific var file includes a "opatch_file" variable is set an Opatch
will be installed by including the run_opatch.yml task file.

The version of the OPatch tool itself is also handed by the above tasks file.

```
- hosts: servers
roles:
- role: ibm.spm_middleware.weblogic
weblogic_version: 14.1.1.0.210716
```

## Note

1. Default JDK version is 1.8.0_191. Required by Dev Team.
2. We keep 12.1.3.0.2. This is not the latest version. Required by Dev Team.

## License

MIT
30 changes: 30 additions & 0 deletions roles/weblogic/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
weblogic_home: '/home/oracle/Oracle/Middleware/Oracle_Home'
weblogic_user: 'oracle'
weblogic_group: 'oinstall'
weblogic_os_user_pass: 'oracle'
weblogic_base: '/home/oracle'
# If not passed in, use this default value
weblogic_version: '14.1.1.0.210716'
inv_loc: '/opt/Oracle/oraInventory'
jdk_folder: '/usr/java'
# Common paths and names
domains_home: '{{ weblogic_base }}/config/Domains'
applications_home: '{{ weblogic_base }}/config/applications'
mw_installer_folder: '{{ weblogic_base }}/installer'
domain_username: 'weblogic'
domain_password: 'weblogic'
encrypted_password: 'dummypassword'
server_name: 'CuramServer'
server_port: 7001

# To download installer, patches, opatch and java from http server set download_url
# download_url: # e.g. https://artifactory/repo
# download_header: # e.g. X-JFrog-Art-Api: "{{ lookup('env', 'MYTOKEN') }}"

# Local controller path OR relative path to download_url
weblogic_installer_path: WLS
# Local controller path relative to weblogic_installer_path OR relative path to download_url/weblogic_installer_path
weblogic_patch_path: Patches
# Local controller path OR relative path to download_url
java_zip_path: 'Java'
Loading

0 comments on commit 93b49c8

Please sign in to comment.