Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

molecule: new stage download to prepare dbfs stage #381

Merged
merged 4 commits into from
Sep 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions changelogs/fragments/molecule1.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
minor_changes:
- "molecule: new stage download to prepare dbfs stage (oravirt#381)"
- "molecule: new stage golden to create golden images (oravirt#381)"

bugfixes:
- "molecule: Use shared inventory with download scenario (oravirt#381)"
- "oradb_datapatch: allow execution of role with empty oracle_databases and oracle_pdbs (oravirt#381)"
78 changes: 78 additions & 0 deletions doc/development.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,84 @@ vagrant cloud publish --release ${boxname} "$vagrantversion" virtualbox

== ansible molecule

WARNING: The timeout for pulling docker Container in `molecule` is 15s at the moment. +
There is no parameter to increase the timeout. Pull container manually before starting the szenario. The image url is defined in `molecule.yml`.

The following szenarios are existing in the `ansible-oracle profect.

[options="header" cols="1,4" valign="top"]
|=======================
|Stage |Description
| dbfs | Full stage for installation of RDBMS 19c + Patching and create database. Requires installation media in /vagrant on local host.
| default | Stage for testing common and orahost roles with different Distributions.
| download | Download Patches from support.oracle.com for dbfs stage.
| golden | Create Golden-Image for installation from dbfs.
|=======================

=== Test OS roles

IMPORTANT: This szenario is used, when changes at OS roles should be tested against different OS Distribuitions. +
Most of the tests are included in the `dbfs` szenario!

The execution time is ~10m for a full test.

The `default` szenario requires no parameter `-s`!

.Start download
----
cd extensions
molecule test
----

=== Download Patches for `dbfs` stage

IMPORTANT: Make sure that /vagrant has enough free space for installation media and patches.

.set environment variables for support.oracle.com login
----
export MOS_LOGIN=Username
export MOS_PASSWORD=verySecret
----

.Start download
----
cd extensions
molecule test -s download
----

`molecule test` does the full test of the szenario.

=== Test Single Instance in Filesystem with szenario `dbfs`

IMPORTANT: Make sure that the installation media and patches are placed in `/vagrant` before starting `molecule`. +
Use the szenario `download` for downloading the Patches from support.oracle.com.


The execution time is ~2h for a full test.

.Start download
----
cd extensions
molecule test -s dbfs
----

=== Create Golden-Images from `dbfs` installation

IMPORTANT: Make sure that all requirements for scenario `dbfs` are met. +
Executing a full test with `molicule test -s golden` will destroy an existing installation from `molecule converge -s dbfs`!


.Start Golden-Image creation
----
cd extensions
molecule test -s golden
----

=== Oracle XE (not used at the moment!)

IMPORTANT: This chapter was designed for testing the `oradb_managed_`-Roles. +
It is not clear if this will be added or not.

.Docker pull Oracle XE

Normal SSO-Login from Oracle is needed for login to docker registry.
Expand Down
147 changes: 2 additions & 145 deletions extensions/molecule/dbfs/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,148 +23,5 @@ verifier:
provisioner:
name: ansible
inventory:
group_vars:
all:
configure_epel_repo: true
configure_etc_hosts: false # not supported inside docker
configure_motd: false # templates for motd uses ansible_facts with non existing values inside docker
configure_ntp: false # not supported inside a container
disable_selinux: false # not supported inside a container
# device_persistence: ''

oracle_sw_source_local: /vagrant
apply_patches_db: true

# special test with copy patches via www
# is_sw_source_local: false
# oracle_sw_source_www: http://10.0.2.15:8080

db_homes_installed:
- home: db19-si-ee
state: present
apply_patches: false # patching is done in side-effect.yml!

oracle_sw_patches:
- filename: p35320081_190000_Linux-x86-64.zip
patchid: 35320081
version: 19.3.0.0
description: Database Release Update 19.20.0.0.230718
- filename: p35354406_190000_Linux-x86-64.zip
patchid: 35354406
version: 19.3.0.0
description: OJVM RELEASE UPDATE 19.20.0.0.0
- filename: p35512813_1920000DBRU_Generic.zip
patchid: 35512813
version: 19.3.0.0
description: DATAPUMP BUNDLE PATCH 19.20.0.0.0
- filename: p29213893_193000DBRU_Generic.zip
patchid: 29213893
unique_patchid: 22948049
version: 19.3.0.0
description: "DBMS_STATS FAILING WITH ERROR ORA-01422"
- filename: p29213893_1915000DBRU_Generic.zip
patchid: 29213893
unique_patchid: 24722761
version: 19.3.0.0
description: "DBMS_STATS FAILING WITH ERROR ORA-01422"
- filename: p29213893_1920000DBRU_Generic.zip
patchid: 29213893
unique_patchid: 25224952
version: 19.3.0.0
description: "DBMS_STATS FAILING WITH ERROR ORA-01422"

db_homes_config:
db19-si-ee:
version: 19.3.0.0
oracle_home: /u01/app/oracle/product/19/db19-si-ee
edition: EE
opatch_minversion: 12.2.0.1.36
# imagename: db_home_19.15.zip
opatch:
- patchid: 35320081
# Database Release Update 19.20.0.0.230718
patchversion: 19.20.0.0.230718
stop_processes: true
state: present
- patchid: 35354406
# Oracle JavaVM Component Release Update (OJVM RU) 19.20.0.0.230718
stop_processes: true
state: present
- patchid: 35512813
# DATAPUMP BUNDLE PATCH 19.20.0.0.0
stop_processes: false
state: present

oracle_listeners_config:
LISTENER:
home: db19-si-ee
address:
- host: "{{ ansible_hostname }}"
protocol: TCP
port: 1521

listener_installed:
- home: db19-si-ee
listener_name: LISTENER
state: present

oracle_databases:
- home: db19-si-ee
oracle_db_name: &oracle_db_name DB1
oracle_db_type: SI
is_container: true
storage_type: FS
oracle_db_mem_totalmb: 1024
oracle_database_type: MULTIPURPOSE
redolog_size: 50M
redolog_groups: 3
datafile_dest: /u01/app/oracle/oradata
recoveryfile_dest: /u01/app/oracle//fra
listener_name: LISTENER
listener_port: &cdb_listener_port 1521
# *local_listener is used in initparam as an achor
local_listener: &local_listener "{{ ansible_hostname }}:1521"
archivelog: false
flashback: false
force_logging: true
state: present
statspack:
purgedays: 14
snaplevel: 7
tablespace: PERFSTAT
state: present
tablespaces:
- name: PERFSTAT
size: 10M
autoextend: true
next: 50M
maxsize: 4G
content: permanent
state: present
init_parameters:
- {name: db_create_file_dest, value: '/u01/app/oracle/oradata', scope: both, state: present}
- {name: db_create_online_log_dest_1, value: '/u01/app/oracle/oradata', scope: both, state: present}
- {name: recyclebin, value: 'off', scope: spfile, state: present}
- {name: pga_aggregate_target, value: '128M', scope: both, state: present}
- {name: sga_target, value: '1808M', scope: spfile, state: present, dbca: false}

oracle_pdbs:
- cdb: DB1
home: db19-si-ee
pdb_name: ORCLPDB
listener_port: 1521
state: present
datafile_dest: /u01/app/oracle/oradata
statspack:
purgedays: 14
snaplevel: 7
tablespace: PERFSTAT
state: present
tablespaces:
- name: PERFSTAT
size: 10M
autoextend: true
next: 50M
maxsize: 4G
content: permanent
state: present
links:
group_vars: ../shared_config/inventory/group_vars/
59 changes: 0 additions & 59 deletions extensions/molecule/dbfs/side_effect.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,72 +4,13 @@
ansible.builtin.import_playbook: opitzconsulting.ansible_oracle.opatch
vars:
is_sw_source_local: true
oracle_sw_patches:
- filename: p29213893_1915000DBRU_Generic.zip
patchid: 29213893
unique_patchid: 24722761
version: 19.3.0.0
description: "DBMS_STATS FAILING WITH ERROR ORA-01422"
- filename: p35320081_190000_Linux-x86-64.zip
patchid: 35320081
version: 19.3.0.0
description: Database Release Update 19.20.0.0.230718
- filename: p35354406_190000_Linux-x86-64.zip
patchid: 35354406
version: 19.3.0.0
description: OJVM RELEASE UPDATE 19.20.0.0.0
creates: 35354406/README.txt
- filename: p35512813_1920000DBRU_Generic.zip
patchid: 35512813
version: 19.3.0.0
description: DATAPUMP BUNDLE PATCH 19.20.0.0.0
- filename: p29213893_1920000DBRU_Generic.zip
patchid: 29213893
unique_patchid: 25224952
version: 19.3.0.0
description: "DBMS_STATS FAILING WITH ERROR ORA-01422"

db_homes_installed:
- home: db19-si-ee
state: present
apply_patches: true

db_homes_config:
db19-si-ee:
version: 19.3.0.0
oracle_home: /u01/app/oracle/product/19/db19-si-ee
edition: EE
opatch_minversion: 12.2.0.1.36
# imagename: db_home_19.15.zip
opatch:
- {patchid: 29213893, state: absent, excludeUPI: 25224952, stop_processes: true} # 19.3
- {patchid: 29213893, state: absent, excludeUPI: 24722761, stop_processes: true} # 19.15
- patchid: 35320081
# Database Release Update 19.20.0.0.230718
patchversion: 19.20.0.0.230718
stop_processes: true
state: present
- patchid: 35354406
# Oracle JavaVM Component Release Update (OJVM RU) 19.20.0.0.230718
stop_processes: true
state: present
- patchid: 35512813
# DATAPUMP BUNDLE PATCH 19.20.0.0.0
stop_processes: false
state: present
- patchid: 29213893
# DBMS_STATS FAILING WITH ERROR ORA-01422"
stop_processes: true
state: present
excludeUPI: 25224952

- name: Side-Effect - DB-Patching 19.20
ansible.builtin.import_playbook: opitzconsulting.ansible_oracle.opatch
vars:
db_homes_installed:
- home: db19-si-ee
state: present
apply_patches: true

- name: Side-Effect - Manage-DB
ansible.builtin.import_playbook: opitzconsulting.ansible_oracle.manage_db
Expand Down
5 changes: 5 additions & 0 deletions extensions/molecule/download/collections.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
collections:
# Use current directory as collection source
- source: ./..
type: dir
21 changes: 21 additions & 0 deletions extensions/molecule/download/converge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
- name: Converge
hosts: all
gather_facts: true
any_errors_fatal: true
vars:
mos_login: "{{ lookup('ansible.builtin.env', 'MOS_LOGIN', default=Undefined) }}"
mos_password: "{{ lookup('ansible.builtin.env', 'MOS_PASSWORD', default=Undefined) }}"
tasks:
# - debug: var=oracle_sw_patches
- name: Assert credentials
ansible.builtin.assert:
quiet: true
that:
- mos_login is defined
- mos_password is defined
fail_msg: "Set MOS_LOGIN and MOS_PASSWORD in shell environment and restart converge again."

- name: "Import orasw_download_patches"
ansible.builtin.import_role:
name: opitzconsulting.ansible_oracle.orasw_download_patches
27 changes: 27 additions & 0 deletions extensions/molecule/download/molecule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
dependency:
name: galaxy
enabled: true

driver:
name: docker
platforms:
- name: download
image: "quay.io/rendanic/docker-${MOLECULE_DISTRO:-ol8}-ansible:latest"
pre_build_image: true
# The following 4 lines are needed only for making systemd work
command: ${MOLECULE_DOCKER_COMMAND:-""}
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:rw
- /vagrant:/vagrant:rw
cgroupns_mode: host
privileged: true

verifier:
name: ansible

provisioner:
name: ansible
inventory:
links:
group_vars: ../shared_config/inventory/group_vars/
10 changes: 10 additions & 0 deletions extensions/molecule/download/verify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
# This is an example playbook to execute Ansible tests.

- name: Verify
hosts: all
gather_facts: false
tasks:
- name: Example assertion
ansible.builtin.assert:
that: true
5 changes: 5 additions & 0 deletions extensions/molecule/golden/collections.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
collections:
# Use current directory as collection source
- source: ./..
type: dir
Loading
Loading