Skip to content

Commit 09b49bc

Browse files
committed
New role: oradb-datapatch. Runs datapath on selected databases after a binary patch is applied
- Uses oracle_datapatch module (oravirt/ansible-oracle-modules@0174bd8)
1 parent 6113a0b commit 09b49bc

File tree

8 files changed

+86
-3
lines changed

8 files changed

+86
-3
lines changed

group_vars/vbox-si-asm/db-homes.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apply_patches_db: False
22
db_homes_config:
33
18300-base:
44
home: db1-base
5-
version: 12.2.0.1
5+
version: 18.3.0.0
66
edition: EE
77
# 12201-base:
88
# home: db1-base

group_vars/vbox-si-asm/gi.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
configure_cluster: false
2-
oracle_install_version_gi: 12.2.0.1
2+
oracle_install_version_gi: 18.3.0.0
33
oracle_asm_init_dg: crs
44

55
apply_patches_gi: True

roles/oradb-datapatch/README.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
oradb-datapatch
2+
=========
3+
4+
This role will run datapatch on selected databases
5+
6+
7+
8+
Role Variables
9+
--------------
10+
11+
```
12+
oracle_user: oracle
13+
db_user: sys
14+
db_password: "{% if dbpasswords is defined and dbpasswords[item.oracle_db_name] is defined and dbpasswords[item.oracle_db_name][db_user] is defined%}{{dbpasswords[item.oracle_db_name][db_user]}}{% else %}{{ default_dbpass}}{% endif%}"
15+
16+
db_service_name: "{%- if item.oracle_db_unique_name is defined -%}
17+
{{ item.oracle_db_unique_name }}
18+
{%- else -%}
19+
{{ item.oracle_db_name }}
20+
{%- endif -%}"
21+
22+
listener_port_template: "{% if item.listener_port is defined %}{{ item.listener_port }}{% else %}{{ listener_port }}{% endif %}"
23+
listener_port: 1521
24+
fail_on_db_not_exist: False <-- If the DB is not yet created at the time of the datapatch run, we still want the play to continue
25+
```
26+
27+
28+
Example Playbook
29+
----------------
30+
31+
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
32+
33+
- hosts: servers
34+
roles:
35+
- { role: oradb-datapatch }
36+
37+
Author Information
38+
------------------
39+
40+
Mikael Sandström, oravirt@gmail.com, @oravirt
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
hostgroup: "{{ group_names[0] }}"
2+
oracle_user: oracle
3+
4+
db_user: sys
5+
db_password: "{% if dbpasswords is defined and dbpasswords[item.oracle_db_name] is defined and dbpasswords[item.oracle_db_name][db_user] is defined%}{{dbpasswords[item.oracle_db_name][db_user]}}{% else %}{{ default_dbpass}}{% endif%}"
6+
7+
db_service_name: "{%- if item.oracle_db_unique_name is defined -%}
8+
{{ item.oracle_db_unique_name }}
9+
{%- else -%}
10+
{{ item.oracle_db_name }}
11+
{%- endif -%}"
12+
13+
listener_port_template: "{% if item.listener_port is defined %}{{ item.listener_port }}{% else %}{{ listener_port }}{% endif %}"
14+
listener_port: 1521
15+
16+
oracle_env:
17+
ORACLE_HOME: "{{ oracle_home_db}}"
18+
LD_LIBRARY_PATH: "{{ oracle_home_db}}/lib"
19+
20+
fail_on_db_not_exist: False
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
dependencies:
2+
- { role: orasw-meta }
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
- name: oradb-datapatch | Run datapatch
2+
oracle_datapatch:
3+
oracle_home={{ oracle_home_db }}
4+
db_name={{ item.oracle_db_name }}
5+
oracle_db_unique_name={{ item.oracle_db_unique_name |default(omit)}}
6+
output=verbose
7+
fail_on_db_not_exist={{ fail_on_db_not_exist }}
8+
user={{ db_user }}
9+
password={{db_password}}
10+
hostname={{ansible_fqdn}}
11+
service_name={{ db_service_name }}
12+
port={{ listener_port_template }}
13+
with_items: "{{ oracle_databases }}"
14+
when: item.state|lower == 'present'
15+
become: True
16+
become_user: "{{ oracle_user }}"
17+
tags: datapatch

roles/orasw-meta/defaults/main.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ oracle_opatch_patch:
6363
- { filename: p6880880_112000_Linux-x86-64.zip, version: 11.2.0.3 }
6464

6565

66-
66+
default_dbpass: Oracle_123
67+
oracle_base: /u01/app/oracle
6768
oracle_home_db: "{%- if dbh is defined -%}
6869
{%- if db_homes_config[dbh.home]['oracle_home'] is defined -%}
6970
{{db_homes_config[dbh.home]['oracle_home']}}

roles/oraswgi-manage-patches/defaults/main.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@
4242
patch_before_rootsh: True
4343

4444
gi_patches:
45+
18.3.0.0:
46+
opatchauto: []
47+
opatch: []
4548
12.2.0.1:
4649
opatch_minversion: 12.2.0.1.12
4750
opatchauto:

0 commit comments

Comments
 (0)