From ffd423cf6536c4aad5f2293e859ef8081dd6668c Mon Sep 17 00:00:00 2001 From: Thorsten Bruhns Date: Mon, 25 Sep 2023 07:20:31 +0000 Subject: [PATCH 1/4] molecule: new stage download to prepare dbfs stage --- changelogs/fragments/molecule1.yml | 3 + doc/development.adoc | 65 ++++++++ extensions/molecule/download/collections.yml | 5 + extensions/molecule/download/converge.yml | 21 +++ extensions/molecule/download/molecule.yml | 27 ++++ extensions/molecule/download/verify.yml | 10 ++ .../inventory/group_vars/all/oracle_db.yml | 140 ++++++++++++++++++ .../inventory/group_vars/all/os.yml | 7 + 8 files changed, 278 insertions(+) create mode 100644 changelogs/fragments/molecule1.yml create mode 100644 extensions/molecule/download/collections.yml create mode 100644 extensions/molecule/download/converge.yml create mode 100644 extensions/molecule/download/molecule.yml create mode 100644 extensions/molecule/download/verify.yml create mode 100644 extensions/molecule/shared_config/inventory/group_vars/all/oracle_db.yml create mode 100644 extensions/molecule/shared_config/inventory/group_vars/all/os.yml diff --git a/changelogs/fragments/molecule1.yml b/changelogs/fragments/molecule1.yml new file mode 100644 index 000000000..9482eddbc --- /dev/null +++ b/changelogs/fragments/molecule1.yml @@ -0,0 +1,3 @@ +--- +minor_changes: + - "molecule: new stage download to prepare dbfs stage (oravirt#381)" diff --git a/doc/development.adoc b/doc/development.adoc index c7b63e66c..8607cf1e5 100644 --- a/doc/development.adoc +++ b/doc/development.adoc @@ -205,6 +205,71 @@ 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. +|======================= + +=== 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 +---- + +=== 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. diff --git a/extensions/molecule/download/collections.yml b/extensions/molecule/download/collections.yml new file mode 100644 index 000000000..e046fc4ce --- /dev/null +++ b/extensions/molecule/download/collections.yml @@ -0,0 +1,5 @@ +--- +collections: + # Use current directory as collection source + - source: ./.. + type: dir diff --git a/extensions/molecule/download/converge.yml b/extensions/molecule/download/converge.yml new file mode 100644 index 000000000..4426b968e --- /dev/null +++ b/extensions/molecule/download/converge.yml @@ -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 diff --git a/extensions/molecule/download/molecule.yml b/extensions/molecule/download/molecule.yml new file mode 100644 index 000000000..51fd31741 --- /dev/null +++ b/extensions/molecule/download/molecule.yml @@ -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/ diff --git a/extensions/molecule/download/verify.yml b/extensions/molecule/download/verify.yml new file mode 100644 index 000000000..a5cfa75e4 --- /dev/null +++ b/extensions/molecule/download/verify.yml @@ -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 diff --git a/extensions/molecule/shared_config/inventory/group_vars/all/oracle_db.yml b/extensions/molecule/shared_config/inventory/group_vars/all/oracle_db.yml new file mode 100644 index 000000000..99a8eb1ac --- /dev/null +++ b/extensions/molecule/shared_config/inventory/group_vars/all/oracle_db.yml @@ -0,0 +1,140 @@ +--- +# special test with copy patches via www +# is_sw_source_local: false +# oracle_sw_source_www: http://10.0.2.15:8080 + +oracle_sw_source_local: /vagrant + +apply_patches_db: true + +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 + 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" + +# Important! +# The converge.yml disables the installation of patches. +# That is tested in side-effect.yml with installation of OneOff 29213893 for 19.3. +# The OneOff is removed before the installation of RU 19.20 and then reinstalled with the +db_homes_installed: + - home: db19-si-ee + state: present + apply_patches: false # patching is done in side-effect.yml! + +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 + +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 diff --git a/extensions/molecule/shared_config/inventory/group_vars/all/os.yml b/extensions/molecule/shared_config/inventory/group_vars/all/os.yml new file mode 100644 index 000000000..f5b4be66b --- /dev/null +++ b/extensions/molecule/shared_config/inventory/group_vars/all/os.yml @@ -0,0 +1,7 @@ +--- +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: '' From de013d7354627fb423bc957fd0168a5cee022ba9 Mon Sep 17 00:00:00 2001 From: Thorsten Bruhns Date: Mon, 25 Sep 2023 19:46:50 +0000 Subject: [PATCH 2/4] molecule: Use shared inventory with download scenario --- changelogs/fragments/molecule1.yml | 3 + extensions/molecule/dbfs/molecule.yml | 147 +---------------------- extensions/molecule/dbfs/side_effect.yml | 59 --------- 3 files changed, 5 insertions(+), 204 deletions(-) diff --git a/changelogs/fragments/molecule1.yml b/changelogs/fragments/molecule1.yml index 9482eddbc..9b495099d 100644 --- a/changelogs/fragments/molecule1.yml +++ b/changelogs/fragments/molecule1.yml @@ -1,3 +1,6 @@ --- minor_changes: - "molecule: new stage download to prepare dbfs stage (oravirt#381)" + +bugfixes: + - "molecule: Use shared inventory with download scenario (oravirt#381)" diff --git a/extensions/molecule/dbfs/molecule.yml b/extensions/molecule/dbfs/molecule.yml index 2a4f29f9c..5351a4cc8 100644 --- a/extensions/molecule/dbfs/molecule.yml +++ b/extensions/molecule/dbfs/molecule.yml @@ -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/ diff --git a/extensions/molecule/dbfs/side_effect.yml b/extensions/molecule/dbfs/side_effect.yml index 620286d5d..f60cab7dc 100644 --- a/extensions/molecule/dbfs/side_effect.yml +++ b/extensions/molecule/dbfs/side_effect.yml @@ -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 From 9c5e1a30839768369ec7dc73e7148707274a25bf Mon Sep 17 00:00:00 2001 From: Thorsten Bruhns Date: Tue, 26 Sep 2023 09:18:35 +0000 Subject: [PATCH 3/4] molecule: new stage golden to create golden images --- changelogs/fragments/molecule1.yml | 1 + doc/development.adoc | 13 +++++++++ extensions/molecule/golden/collections.yml | 5 ++++ extensions/molecule/golden/converge.yml | 24 +++++++++++++++++ extensions/molecule/golden/molecule.yml | 27 +++++++++++++++++++ extensions/molecule/golden/verify.yml | 10 +++++++ .../inventory/group_vars/all/oracle_db.yml | 3 +++ 7 files changed, 83 insertions(+) create mode 100644 extensions/molecule/golden/collections.yml create mode 100644 extensions/molecule/golden/converge.yml create mode 100644 extensions/molecule/golden/molecule.yml create mode 100644 extensions/molecule/golden/verify.yml diff --git a/changelogs/fragments/molecule1.yml b/changelogs/fragments/molecule1.yml index 9b495099d..23a40d234 100644 --- a/changelogs/fragments/molecule1.yml +++ b/changelogs/fragments/molecule1.yml @@ -1,6 +1,7 @@ --- 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)" diff --git a/doc/development.adoc b/doc/development.adoc index 8607cf1e5..66349cbd1 100644 --- a/doc/development.adoc +++ b/doc/development.adoc @@ -216,6 +216,7 @@ The following szenarios are existing in the `ansible-oracle profect. | 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 @@ -265,6 +266,18 @@ 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. + diff --git a/extensions/molecule/golden/collections.yml b/extensions/molecule/golden/collections.yml new file mode 100644 index 000000000..e046fc4ce --- /dev/null +++ b/extensions/molecule/golden/collections.yml @@ -0,0 +1,5 @@ +--- +collections: + # Use current directory as collection source + - source: ./.. + type: dir diff --git a/extensions/molecule/golden/converge.yml b/extensions/molecule/golden/converge.yml new file mode 100644 index 000000000..7eaded0d9 --- /dev/null +++ b/extensions/molecule/golden/converge.yml @@ -0,0 +1,24 @@ +--- +- name: Converge os + ansible.builtin.import_playbook: opitzconsulting.ansible_oracle.os + +- name: Converge swdb + ansible.builtin.import_playbook: opitzconsulting.ansible_oracle.swdb + vars: + # install it directly from remote in this test + # => Do not copy the installation media into container + oracle_sw_copy: false + is_sw_source_local: true + oracle_stage_remote: /vagrant + +- name: Converge - DB-Patching + ansible.builtin.import_playbook: opitzconsulting.ansible_oracle.opatch + vars: + # the shared inventory has configured databases. + # => Datapatch will try to start a database in this playbook + # => Remove them in this scenario, because we do not need any database + oracle_databases: [] + oracle_pdbs: [] + +- name: Converge oraswdb_golden_image + ansible.builtin.import_playbook: opitzconsulting.ansible_oracle.golden_images diff --git a/extensions/molecule/golden/molecule.yml b/extensions/molecule/golden/molecule.yml new file mode 100644 index 000000000..5351a4cc8 --- /dev/null +++ b/extensions/molecule/golden/molecule.yml @@ -0,0 +1,27 @@ +--- +dependency: + name: galaxy + enabled: true + +driver: + name: docker +platforms: + - name: ol + 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:ro + cgroupns_mode: host + privileged: true + +verifier: + name: ansible + +provisioner: + name: ansible + inventory: + links: + group_vars: ../shared_config/inventory/group_vars/ diff --git a/extensions/molecule/golden/verify.yml b/extensions/molecule/golden/verify.yml new file mode 100644 index 000000000..a5cfa75e4 --- /dev/null +++ b/extensions/molecule/golden/verify.yml @@ -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 diff --git a/extensions/molecule/shared_config/inventory/group_vars/all/oracle_db.yml b/extensions/molecule/shared_config/inventory/group_vars/all/oracle_db.yml index 99a8eb1ac..9e40cb200 100644 --- a/extensions/molecule/shared_config/inventory/group_vars/all/oracle_db.yml +++ b/extensions/molecule/shared_config/inventory/group_vars/all/oracle_db.yml @@ -3,6 +3,9 @@ # is_sw_source_local: false # oracle_sw_source_www: http://10.0.2.15:8080 +oraswdb_golen_image_create: true +golden_image_dest: /u01/golden + oracle_sw_source_local: /vagrant apply_patches_db: true From ded68957633cf5a23295f3fb02252446e5267140 Mon Sep 17 00:00:00 2001 From: Thorsten Bruhns Date: Tue, 26 Sep 2023 10:44:39 +0000 Subject: [PATCH 4/4] oradb_datapatch: allow execution of role with empty oracle_databases and oracle_pdbs --- changelogs/fragments/molecule1.yml | 1 + roles/oradb_datapatch/tasks/main.yml | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/changelogs/fragments/molecule1.yml b/changelogs/fragments/molecule1.yml index 23a40d234..a1b5fb9b8 100644 --- a/changelogs/fragments/molecule1.yml +++ b/changelogs/fragments/molecule1.yml @@ -5,3 +5,4 @@ minor_changes: 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)" diff --git a/roles/oradb_datapatch/tasks/main.yml b/roles/oradb_datapatch/tasks/main.yml index 6b2d61d3b..22d725751 100644 --- a/roles/oradb_datapatch/tasks/main.yml +++ b/roles/oradb_datapatch/tasks/main.yml @@ -12,6 +12,7 @@ ORACLE_HOME: {{ listener_home }} when: - listener_installed is defined + - listener_installed | length > 0 - lsnrinst.state | lower == 'present' - name: oradb_datapatch | Start database @@ -30,6 +31,7 @@ db_name: {{ odb.oracle_db_name }} when: - oracle_databases is defined + - oracle_databases | list | length > 0 tags: startdb # @todo bug: Do we really need db-connection here? @@ -53,9 +55,10 @@ loop_control: loop_var: odb label: >- - home: {{ odb.0.home }} - db_name: {{ odb.0.oracle_db_name }}" + home: {{ odb.0.home | default('') }} + db_name: {{ odb.0.oracle_db_name | default('') }}" when: - oracle_databases is defined + - oracle_databases | list | length > 0 - odb.0.state == 'present' tags: datapatch