Skip to content

Commit

Permalink
New Oracle Database Role (#26)
Browse files Browse the repository at this point in the history
* first try

* add oracle tests

* meta

* update readme

* linter

* avoid timeout for 12cR1 applying patch

* update readme

* need to become user to check status

* give 15 mins for patch to install

* update version in galaxy.yml

* remove url defaults
  • Loading branch information
salob authored Oct 14, 2021
1 parent 93b49c8 commit 3256837
Show file tree
Hide file tree
Showing 36 changed files with 2,350 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ env:
- SCENARIO=websphere-v85-centos-7
- SCENARIO=db2111
- SCENARIO=db2115
- SCENARIO=oracle12cR1-centos-7
- SCENARIO=oracle12cR2-centos-7
- SCENARIO=oracle19c-centos-8
- SCENARIO=iim-191-centos-8
- SCENARIO=ihs-v90-centos-8
- SCENARIO=ihs-v80-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.0.9
version: 1.1.0

# 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/__oracle-v12cR1/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:
oracle_version: 12.1.0.2.210720
download_url: "{{ lookup('env', 'ARTIFACTORY_URL') }}/{{ lookup('env', 'ARTIFACTORY_REPO') }}/SoftwareInstallers"
download_header: { 'X-JFrog-Art-Api': "{{ lookup('env', 'ARTIFACTORY_TOKEN') }}"}

roles:
- oracle
77 changes: 77 additions & 0 deletions molecule/__oracle-v12cR1/verify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
---
# This is an example playbook to execute Ansible tests.

- name: Verify
hosts: all
vars:
oracle_home: /opt/oracle/product/12c/dbhome_1
oracle_sid: orcl
patch_number: 32768233

pre_tasks:
- name: Check if DB exists
stat:
path: /opt/oracle/oradata/orcl
register: db_dir

- name: Check Bootstrap Files
stat:
path: /opt/Props/Bootstrap.properties
register: bootstrap_properties

- name: Check if correct version installed
become: yes
become_user: oracle
shell: "$ORACLE_HOME/OPatch/opatch lspatches | grep -i {{ patch_number }}"
register: oracle_version_status
changed_when: False
ignore_errors: True
environment:
ORACLE_HOME: "{{ oracle_home }}"
ORACLE_SID: "{{ oracle_sid }}"

- name: Check if DB Configured
become: yes
become_user: oracle
shell: "echo \"SELECT USERNAME FROM DBA_USERS WHERE USERNAME='CURAM';\" | $ORACLE_HOME/bin/sqlplus / as sysdba | grep -i curam"
register: db_config_status
changed_when: False
ignore_errors: True
environment:
ORACLE_HOME: "{{ oracle_home }}"
ORACLE_SID: "{{ oracle_sid }}"

- name: Check if start script exists
stat:
path: /home/oracle/scripts/start_all.sh
register: start_script

- name: Check if stop script exists
stat:
path: /home/oracle/scripts/stop_all.sh
register: stop_script

tasks:
- name: Check that db_inst.rsp exists
assert:
that: db_dir.stat.exists

- name: Check that Bootstrap.properties exists
assert:
that: bootstrap_properties.stat.exists

- name: Verify correct version installed
assert:
that: oracle_version_status.rc == 0

- name: Check db is configured
assert:
that: db_config_status.rc == 0

- name: Verify that start script exists
assert:
that: start_script.stat.exists

- name: Verify that stop script exists
assert:
that: stop_script.stat.exists
14 changes: 14 additions & 0 deletions molecule/__oracle-v12cR2/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:
oracle_version: 12.2.0.1.210720
download_url: "{{ lookup('env', 'ARTIFACTORY_URL') }}/{{ lookup('env', 'ARTIFACTORY_REPO') }}/SoftwareInstallers"
download_header: { 'X-JFrog-Art-Api': "{{ lookup('env', 'ARTIFACTORY_TOKEN') }}"}

roles:
- oracle
77 changes: 77 additions & 0 deletions molecule/__oracle-v12cR2/verify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
---
# This is an example playbook to execute Ansible tests.

- name: Verify
hosts: all
vars:
oracle_home: /opt/oracle/product/12c/dbhome_1
oracle_sid: orcl
patch_number: 32916808

pre_tasks:
- name: Check if DB exists
stat:
path: /opt/oracle/oradata/orcl
register: db_dir

- name: Check Bootstrap Files
stat:
path: /opt/Props/Bootstrap.properties
register: bootstrap_properties

- name: Check if correct version installed
become: yes
become_user: oracle
shell: "$ORACLE_HOME/OPatch/opatch lspatches | grep -i {{ patch_number }}"
register: oracle_version_status
changed_when: False
ignore_errors: True
environment:
ORACLE_HOME: "{{ oracle_home }}"
ORACLE_SID: "{{ oracle_sid }}"

- name: Check if DB Configured
become: yes
become_user: oracle
shell: "echo \"SELECT USERNAME FROM DBA_USERS WHERE USERNAME='CURAM';\" | $ORACLE_HOME/bin/sqlplus / as sysdba | grep -i curam"
register: db_config_status
changed_when: False
ignore_errors: True
environment:
ORACLE_HOME: "{{ oracle_home }}"
ORACLE_SID: "{{ oracle_sid }}"

- name: Check if start script exists
stat:
path: /home/oracle/scripts/start_all.sh
register: start_script

- name: Check if stop script exists
stat:
path: /home/oracle/scripts/stop_all.sh
register: stop_script

tasks:
- name: Check that db_inst.rsp exists
assert:
that: db_dir.stat.exists

- name: Check that Bootstrap.properties exists
assert:
that: bootstrap_properties.stat.exists

- name: Verify correct version installed
assert:
that: oracle_version_status.rc == 0

- name: Check db is configured
assert:
that: db_config_status.rc == 0

- name: Verify that start script exists
assert:
that: start_script.stat.exists

- name: Verify that stop script exists
assert:
that: stop_script.stat.exists
14 changes: 14 additions & 0 deletions molecule/__oracle-v19c/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:
oracle_version: 19.11.0.0.0
download_url: "{{ lookup('env', 'ARTIFACTORY_URL') }}/{{ lookup('env', 'ARTIFACTORY_REPO') }}/SoftwareInstallers"
download_header: { 'X-JFrog-Art-Api': "{{ lookup('env', 'ARTIFACTORY_TOKEN') }}"}

roles:
- oracle
77 changes: 77 additions & 0 deletions molecule/__oracle-v19c/verify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
---
# This is an example playbook to execute Ansible tests.

- name: Verify
hosts: all
vars:
oracle_home: /opt/oracle/product/19c/dbhome_1
oracle_sid: orcl
oracle_version: 19.11.0.0.0

pre_tasks:
- name: Check if DB exists
stat:
path: /opt/oracle/oradata/ORCL
register: db_dir

- name: Check Bootstrap Files
stat:
path: /opt/Props/Bootstrap.properties
register: bootstrap_properties

- name: Check if correct version installed
become: yes
become_user: oracle
shell: "echo 'SELECT * FROM v$version;' | $ORACLE_HOME/bin/sqlplus / as sysdba | grep -i {{ oracle_version }}"
register: oracle_version_status
changed_when: False
ignore_errors: True
environment:
ORACLE_HOME: "{{ oracle_home }}"
ORACLE_SID: "{{ oracle_sid }}"

- name: Check if DB Configured
become: yes
become_user: oracle
shell: "echo 'SELECT USERNAME FROM DBA_USERS;' | $ORACLE_HOME/bin/sqlplus / as sysdba | grep CURAM"
register: db_config_status
changed_when: False
ignore_errors: True
environment:
ORACLE_HOME: "{{ oracle_home }}"
ORACLE_SID: "{{ oracle_sid }}"

- name: Check if start script exists
stat:
path: /home/oracle/scripts/start_all.sh
register: start_script

- name: Check if stop script exists
stat:
path: /home/oracle/scripts/stop_all.sh
register: stop_script

tasks:
- name: Check that db_inst.rsp exists
assert:
that: db_dir.stat.exists

- name: Check that Bootstrap.properties exists
assert:
that: bootstrap_properties.stat.exists

- name: Verify correct version installed
assert:
that: oracle_version_status.rc == 0

- name: Check db is configured
assert:
that: db_config_status.rc == 0

- name: Verify that start script exists
assert:
that: start_script.stat.exists

- name: Verify that stop script exists
assert:
that: stop_script.stat.exists
34 changes: 34 additions & 0 deletions molecule/oracle12cR1-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: ../__oracle-v12cR1/converge.yml
verify: ../__oracle-v12cR1/verify.yml
34 changes: 34 additions & 0 deletions molecule/oracle12cR2-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: ../__oracle-v12cR2/converge.yml
verify: ../__oracle-v12cR2c/verify.yml
Loading

0 comments on commit 3256837

Please sign in to comment.