Defined Type: oradb::tnsnames

Defined in:
manifests/tnsnames.pp

Overview

tnsnames

Configure tnsnames entries

Examples:

tnsnames


oradb::tnsnames{'orcl':
  oracle_home          => '/oracle/product/11.2/db',
  user                 => 'oracle',
  group                => 'dba',
  server               => { myserver => { host => soadb.example.nl, port => '1521', protocol => 'TCP' }},
  connect_service_name => 'soarepos.example.nl',
}

oradb::tnsnames{'test':
  oracle_home          => '/oracle/product/11.2/db',
  user                 => 'oracle',
  group                => 'dba',
  server               => { myserver => { host => soadb.example.nl, port => '1525', protocol => 'TCP' }, myserver2 => { host => soadb2.example.nl, port => '1526', protocol => 'TCP' }},
  connect_service_name => 'soarepos.example.nl',
  connect_server       => 'DEDICATED',
}

Parameters:

  • oracle_home (String) (defaults to: undef)

    full path to the Oracle Home directory

  • user (String) (defaults to: lookup('oradb::user'))

    operating system user

  • group (String) (defaults to: lookup('oradb::group'))

    the operating group name for using the oracle software

  • server (Hash) (defaults to: { myserver => { host => undef, port => '1521', protocol => 'TCP' }})

    the tnsnames connection details

  • loadbalance (String) (defaults to: 'ON')

    configure loadbalance on the tnsnames entries

  • failover (String) (defaults to: 'ON')

    configure failover on the tnsnames entries

  • connect_service_name (Optional[String]) (defaults to: undef)

    the service name of the database

  • connect_server (String) (defaults to: 'DEDICATED')

    service connection type

  • entry_type (Enum['tnsnames','listener']) (defaults to: 'tnsnames')

    type of configuration



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'manifests/tnsnames.pp', line 35

define oradb::tnsnames(
  String $oracle_home                     = undef,
  String $user                            = lookup('oradb::user'),
  String $group                           = lookup('oradb::group'),
  Hash   $server                          = { myserver => { host => undef, port => '1521', protocol => 'TCP' }},
  String $loadbalance                     = 'ON',
  String $failover                        = 'ON',
  Optional[String] $connect_service_name  = undef,
  String $connect_server                  = 'DEDICATED',
  Enum['tnsnames','listener'] $entry_type = 'tnsnames',
)
{
  if ! defined(Concat["${oracle_home}/network/admin/tnsnames.ora"]) {
    concat { "${oracle_home}/network/admin/tnsnames.ora":
      ensure         => present,
      owner          => $user,
      group          => $group,
      mode           => '0774',
      ensure_newline => true,
    }
  }

  case $entry_type {
    'tnsnames' : { $template_path = 'oradb/tnsnames.epp' }
    'listener' : { $template_path = 'oradb/listener.epp' }
    default    : { fail("${entry_type} is not a supported entry_type") }
  }

  $size = keys($server).size

  # puppet epp render tnsnames.epp --values "{size => 1 ,title => 'a', server => { myserver => { host => 'dbcdb.example.com',  port => '1525', protocol => 'TCP' }} , loadbalance => 'ON', failover => 'ON' , connect_server => 'aa' , connect_service_name => 'aaa' }"
  # puppet epp render tnsnames.epp --values "{size => 2 , title => 'a', server => { myserver => { host => 'dbcdb.example.com', port => '1525', protocol => 'TCP' }, myserver2 =>  { host => 'dbcdb.example.com', port => '1526', protocol => 'TCP' }  } , loadbalance => 'ON', failover => 'ON' , connect_server => 'aa' , connect_service_name => 'aaa' }"
  concat::fragment { $title:
    target  => "${oracle_home}/network/admin/tnsnames.ora",
    content => epp($template_path , { 'title'                => $title,
                                      'server'               => $server,
                                      'loadbalance'          => $loadbalance,
                                      'failover'             => $failover,
                                      'connect_server'       => $connect_server,
                                      'connect_service_name' => $connect_service_name,
                                      'size'                 => $size
                                      }),
  }
}