forked from biemond/biemond-oradb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdbactions.pp
51 lines (50 loc) · 2 KB
/
dbactions.pp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#
# dbactions
#
# Oracle database control like stop, start & mount
#
# @example dbactions
#
# oradb::dbactions{ 'start testDb':
# oracle_home => '/oracle/product/11.2/db',
# user => 'oracle',
# group => 'dba',
# action => 'start',
# db_name => 'test',
# }
#
# @param user operating system user
# @param group the operating group name for using the oracle software
# @param db_type
# @param oracle_home full path to the Oracle Home directory inside Oracle Base
# @param action start, mount or stop the database
# @param db_name
# @param provider
#
define oradb::dbactions(
Enum['database', 'grid', 'asm'] $db_type = 'database',
Optional[String] $oracle_home = undef,
String $user = lookup('oradb::user'),
String $group = lookup('oradb::group'),
Enum['start', 'stop', 'running', 'abort','mount'] $action = 'start',
String $db_name = lookup('oradb::database_name'),
Enum['srvctl','sqlplus'] $provider = 'sqlplus',
){
if ( $db_type in ['grid','asm'] and $provider != 'srvctl') {
fail('Provider must be srvctl if db_type is grid or asm')
}
if ( $db_type in ['grid','asm'] and !($action in ['running','start','abort','stop'])) {
fail('Unrecognized action for db_type grid and asm, use running, start, abort or stop')
}
if ( $db_type == 'database' and !($action in ['running','start','abort','stop','mount'])) {
fail('Unrecognized action for db_type grid and asm, use running, start, abort, stop or mount')
}
db_control{"instance control ${title}":
ensure => $action,
provider => $provider,
instance_name => $db_name,
oracle_product_home_dir => $oracle_home,
os_user => $user,
db_type => $db_type,
}
}