Defined Type: oradb::installasm

Defined in:
manifests/installasm.pp

Overview

installasm

install grid/asm

Examples:

install asm


oradb::installasm{ 'db_linux-x64':
    version                => '11.2.0.4',
    file                   => 'p13390677_112040_Linux-x86-64_3of7.zip',
    grid_type              => 'HA_CONFIG',
    grid_base              => '/app/grid',
    grid_home              => '/app/grid/product/11.2/grid',
    ora_inventory_dir      => '/app',
    user                   => 'grid',
    asm_diskgroup          => 'DATA',
    disk_discovery_string  => '/nfs_client/asm*',
    disks                  => '/nfs_client/asm_sda_nfs_b1,/nfs_client/asm_sda_nfs_b2',
    disk_redundancy        => 'EXTERNAL',
    remote_file            => false,
    puppet_download_mnt_point => "/software",
}

Parameters:

  • version (Enum['11.2.0.4','12.1.0.1','12.1.0.2','12.2.0.1']) (defaults to: undef)

    Oracle installation version

  • file (String) (defaults to: undef)

    filename of the installation software

  • grid_base (String) (defaults to: undef)

    full path to the Oracle Grid Base directory

  • grid_home (String) (defaults to: undef)

    full path to the Oracle Grid Home directory inside Oracle Grid Base

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

    full path to the Oracle Inventory location directory

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

    operating system user

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

    the location of the base user homes

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

    the operating group name for using the oracle software

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

    location for installation files used by this module

  • bash_profile (Boolean) (defaults to: true)

    add a bash profile to the operating user

  • puppet_download_mnt_point (String) (defaults to: lookup('oradb::module_mountpoint'))

    the location where the installation software is available

  • remote_file (Boolean) (defaults to: true)

    the installation is remote accessiable or not

  • temp_dir (String) (defaults to: lookup('oradb::tmp_dir'))

    location for temporaray file used by the installer

  • grid_type (Enum['HA_CONFIG', 'CRS_CONFIG', 'UPGRADE', 'CRS_SWONLY']) (defaults to: 'HA_CONFIG')
  • stand_alone (Boolean) (defaults to: true)
  • group_install (String) (defaults to: lookup('oradb::grid::group_install'))
  • group_oper (String) (defaults to: lookup('oradb::grid::group_oper'))
  • group_asm (String) (defaults to: lookup('oradb::grid::group_asm'))
  • zip_extract (Boolean) (defaults to: true)
  • sys_asm_password (String) (defaults to: lookup('oradb::grid::default::password'))
  • asm_monitor_password (String) (defaults to: lookup('oradb::grid::default::password'))
  • asm_diskgroup (String) (defaults to: 'DATA')
  • disk_discovery_string (Optional[String]) (defaults to: undef)
  • disk_redundancy (String) (defaults to: 'NORMAL')
  • disk_au_size (Integer) (defaults to: 1)
  • disks (Optional[String]) (defaults to: undef)
  • cluster_name (Optional[String]) (defaults to: undef)
  • scan_name (Optional[String]) (defaults to: undef)
  • scan_port (Optional[Integer]) (defaults to: undef)
  • cluster_nodes (Optional[String]) (defaults to: undef)
  • network_interface_list (Optional[String]) (defaults to: undef)
  • storage_option (Optional[String]) (defaults to: undef)


57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
# File 'manifests/installasm.pp', line 57

define oradb::installasm(
  Enum['11.2.0.4','12.1.0.1','12.1.0.2','12.2.0.1'] $version                       = undef,
  String $file                                                                     = undef,
  Enum['HA_CONFIG', 'CRS_CONFIG', 'UPGRADE', 'CRS_SWONLY'] $grid_type              = 'HA_CONFIG',
  Boolean $stand_alone                                                             = true, # in case of 'CRS_SWONLY' and used as stand alone or in RAC
  String $grid_base                                                                = undef,
  String $grid_home                                                                = undef,
  Optional[String] $ora_inventory_dir                                              = undef,
  String $user                                                                     = lookup('oradb::grid::user'),
  String $user_base_dir                                                            = lookup('oradb::user_base_dir'),
  String $group                                                                    = lookup('oradb::grid::group'),
  String $group_install                                                            = lookup('oradb::grid::group_install'),
  String $group_oper                                                               = lookup('oradb::grid::group_oper'),
  String $group_asm                                                                = lookup('oradb::grid::group_asm'),
  String $download_dir                                                             = lookup('oradb::download_dir'),
  Boolean $zip_extract                                                             = true,
  String $puppet_download_mnt_point                                                = lookup('oradb::module_mountpoint'),
  String $sys_asm_password                                                         = lookup('oradb::grid::default::password'),
  String $asm_monitor_password                                                     = lookup('oradb::grid::default::password'),
  String $asm_diskgroup                                                            = 'DATA',
  Optional[String] $disk_discovery_string                                          = undef,
  String $disk_redundancy                                                          = 'NORMAL',
  Integer $disk_au_size                                                            = 1,
  Optional[String] $disks                                                          = undef,
  Boolean $remote_file                                                             = true,
  Optional[String] $cluster_name                                                   = undef,
  Optional[String] $scan_name                                                      = undef,
  Optional[Integer] $scan_port                                                     = undef,
  Optional[String] $cluster_nodes                                                  = undef,
  Optional[String] $network_interface_list                                         = undef,
  Optional[String] $storage_option                                                 = undef,
  String $temp_dir                                                                 = lookup('oradb::tmp_dir'),
  Boolean $bash_profile                                                            = true,
)
{

  case $disk_au_size {
    1, 2, 4, 8, 16, 32, 64: {  } # Do nothing. These are valid values
    default: {
      fail("${disk_au_size} is an invalid disk_au_size. It needs to be one of these values: 1, 2, 4, 8, 16, 32, 64")
    }
  }
  $file_without_ext = regsubst($file, '(.+?)(\.zip*$|$)', '\1')
  #notify {"oradb::installasm file without extension ${$file_without_ext} ":}

  if($cluster_name){ # We've got a RAC cluster. Check the cluster specific parameters
    if ( $scan_name == undef or is_string($scan_name) == false) {fail('You must specify scan_name if cluster_name is defined') }
    if ( $scan_port == undef or is_integer($scan_port) == false) {fail('You must specify scan_port if cluster_name is defined') }
    if ( $cluster_nodes == undef or is_string($cluster_nodes) == false) {fail('You must specify cluster_nodes if cluster_name is defined') }
    if ( $network_interface_list == undef or is_string($network_interface_list) == false) {fail('You must specify network_interface_list if cluster_name is defined') }
    if ( $storage_option == undef or is_string($storage_option) == false) {fail('You must specify storage_option if cluster_name is defined') }
    unless $storage_option in ['ASM_STORAGE', 'FILE_SYSTEM_STORAGE'] {fail 'storage_option must be either ASM_STORAGE of FILE_SYSTEM_STORAGE'}
  }

  $supported_grid_versions = join( lookup('oradb::grid_versions'), '|')
  if ( $version in $supported_grid_versions == false ){
    fail("Unrecognized database grid install version, use ${supported_grid_versions}")
  }

  $supported_db_kernels = join( lookup('oradb::kernels'), '|')
  if ( $::kernel in $supported_db_kernels == false){
    fail("Unrecognized operating system, please use it on a ${supported_db_kernels} host")
  }

  $supported_grid_types = join( lookup('oradb::grid_type'), '|')
  if ($grid_type in $supported_grid_types == false ){
    fail("Unrecognized database grid type, please use ${supported_grid_types}")
  }

  if ( $grid_base == undef or is_string($grid_base) == false) {fail('You must specify an grid_base') }
  if ( $grid_home == undef or is_string($grid_home) == false) {fail('You must specify an grid_home') }

  # check if the oracle software already exists
  $found = oradb::oracle_exists( $grid_home )

  if $found == undef {
    $continue = true
  } else {
    if ( $found ) {
      $continue = false
    } else {
      notify {"oradb::installasm ${grid_home} does not exists":}
      $continue = true
    }
  }

  if $ora_inventory_dir == undef {
    $ora_inventory = oradb::cleanpath("${grid_base}/../oraInventory")
  } else {
    validate_absolute_path($ora_inventory_dir)
    $ora_inventory = "${ora_inventory_dir}/oraInventory"
  }

  db_directory_structure{"grid structure ${version}":
    ensure            => present,
    oracle_base_dir   => $grid_base,
    oracle_home_dir   => $grid_home,
    ora_inventory_dir => $ora_inventory,
    download_dir      => $download_dir,
    os_user           => $user,
    os_group          => $group_install,
  }

  if ( $continue ) {

    $exec_path = lookup('oradb::exec_path')

    if ( $zip_extract ) {
      # In $download_dir, will Puppet extract the ZIP files or is this a pre-extracted directory structure.
      if ( $version in ['12.2.0.1']) {
        $file1 = "${file}.zip"
        $total_files = 1
      }

      if ( $version in ['12.1.0.1','12.1.0.2']) {
        $file1 = "${file}_1of2.zip"
        $file2 = "${file}_2of2.zip"
        $total_files = 2
      }

      if ( $version in ['11.2.0.4']) {
        $file1 = $file
        $total_files = 1
      }

      if $remote_file == true {

        file { "${download_dir}/${file1}":
          ensure  => present,
          source  => "${puppet_download_mnt_point}/${file1}",
          mode    => '0775',
          owner   => $user,
          group   => $group,
          require => Db_directory_structure["grid structure ${version}"],
          before  => Exec["extract ${download_dir}/${file1}"],
        }

        if ( $total_files > 1 ) {
          file { "${download_dir}/${file2}":
            ensure  => present,
            source  => "${puppet_download_mnt_point}/${file2}",
            mode    => '0775',
            owner   => $user,
            group   => $group,
            require => File["${download_dir}/${file1}"],
            before  => Exec["extract ${download_dir}/${file2}"]
          }
        }

        $source = $download_dir
      } else {
        $source = $puppet_download_mnt_point
      }

      if ($version == '12.2.0.1') {
        exec { "make ${grid_home}":
          command   => "mkdir -p ${grid_home}",
          timeout   => 0,
          logoutput => false,
          path      => $exec_path,
          user      => $user,
          group     => $group,
          creates   => $grid_home,
          require   => Db_directory_structure["grid structure ${version}"],
          before    => Exec["install oracle grid ${title}"],
        }
        file { $grid_home:
          ensure  => directory,
          recurse => false,
          replace => false,
          mode    => '0775',
          owner   => $user,
          group   => $group_install,
          require => [Db_directory_structure["grid structure ${version}"], Exec["make ${grid_home}"]],
        }
        exec { "extract ${download_dir}/${file1}":
          command   => "unzip -o ${source}/${file1} -d ${grid_home}",
          timeout   => 0,
          logoutput => false,
          path      => $exec_path,
          user      => $user,
          group     => $group,
          creates   => "${grid_home}/bin",
          require   => [Db_directory_structure["grid structure ${version}"], File[$grid_home]],
          before    => Exec["install oracle grid ${title}"],
        }
      } else {
        exec { "extract ${download_dir}/${file1}":
          command   => "unzip -o ${source}/${file1} -d ${download_dir}/${file_without_ext}",
          timeout   => 0,
          logoutput => false,
          path      => $exec_path,
          user      => $user,
          group     => $group,
          creates   => "${download_dir}/${file_without_ext}",
          require   => Db_directory_structure["grid structure ${version}"],
          before    => Exec["install oracle grid ${title}"],
        }
        if ( $total_files > 1 ) {
          exec { "extract ${download_dir}/${file2}":
            command   => "unzip -o ${source}/${file2} -d ${download_dir}/${file_without_ext}",
            timeout   => 0,
            logoutput => false,
            path      => $exec_path,
            user      => $user,
            group     => $group,
            require   => Exec["extract ${download_dir}/${file1}"],
            before    => Exec["install oracle grid ${title}"],
          }
        }
      }
    }

    oradb::utils::dborainst{"grid orainst ${version}":
      ora_inventory_dir => $ora_inventory,
      os_group          => $group_install,
    }

    if ! defined(File["${download_dir}/grid_install_${version}.rsp"]) {
      file { "${download_dir}/grid_install_${version}.rsp":
        ensure  => present,
        content => epp("oradb/grid_install_${version}.rsp.epp",
                      { 'group_install'          =>  $group_install,
                        'oraInventory'           =>  $ora_inventory,
                        'grid_base'              =>  $grid_base,
                        'grid_home'              =>  $grid_home,
                        'group_oper'             =>  $group_oper,
                        'group'                  =>  $group,
                        'group_asm'              =>  $group_asm,
                        'scan_name'              =>  $scan_name,
                        'scan_port'              =>  $scan_port,
                        'grid_type'              =>  $grid_type,
                        'cluster_name'           =>  $cluster_name,
                        'cluster_nodes'          =>  $cluster_nodes,
                        'network_interface_list' =>  $network_interface_list,
                        'storage_option'         =>  $storage_option,
                        'sys_asm_password'       =>  $sys_asm_password,
                        'asm_monitor_password'   =>  $asm_monitor_password,
                        'asm_diskgroup'          =>  $asm_diskgroup,
                        'disk_redundancy'        =>  $disk_redundancy,
                        'disk_au_size'           =>  $disk_au_size,
                        'disks'                  =>  $disks,
                        'disk_discovery_string'  =>  $disk_discovery_string }),
        mode    => '0770',
        owner   => $user,
        group   => $group,
        require => [Oradb::Utils::Dborainst["grid orainst ${version}"],
                    Db_directory_structure["grid structure ${version}"],],
      }
    }

    if ($version == '12.2.0.1') {
      $command = "/bin/sh -c 'unset DISPLAY;cd ${grid_home};./gridSetup.sh -silent -waitforcompletion -skipPrereqs -responseFile ${download_dir}/grid_install_${version}.rsp'"
    } else {
      $command = "/bin/sh -c 'unset DISPLAY;cd ${grid_base};${download_dir}/${file_without_ext}/grid/runInstaller -silent -waitforcompletion -ignoreSysPrereqs -ignorePrereq -responseFile ${download_dir}/grid_install_${version}.rsp'"
    }

    exec { "install oracle grid ${title}":
      command     => $command,
      # creates     => "${grid_home}/bin",
      environment => ["USER=${user}","LOGNAME=${user}"],
      timeout     => 0,
      returns     => [6,0],
      path        => $exec_path,
      user        => $user,
      group       => $group_install,
      logoutput   => true,
      require     => [Oradb::Utils::Dborainst["grid orainst ${version}"],
                      File["${download_dir}/grid_install_${version}.rsp"]],
    }

    if ( $bash_profile == true ) {
      if ! defined(File["${user_base_dir}/${user}/.bash_profile"]) {
        file { "${user_base_dir}/${user}/.bash_profile":
          ensure  => present,
          # content => template('oradb/grid_bash_profile.erb'),
          content => regsubst(epp('oradb/grid_bash_profile.epp',
                              { 'grid_home' => $grid_home,
                                'grid_base' => $grid_base,
                                'grid_type' => $grid_type,
                                'temp_dir'  => $temp_dir }), '\r\n', "\n", 'EMG'),
          mode    => '0775',
          owner   => $user,
          group   => $group,
        }
      }
    }

    #because of RHEL7 uses systemd we need to create the service differently
    if ($facts['osfamily'] == 'RedHat' and $facts['operatingsystemmajrelease'] == '7')
    {
      file {'/etc/systemd/system/oracle-ohasd.service':
        ensure  => 'file',
        content => epp('oradb/ohas.service.epp'),
        mode    => '0644',
        require => Exec["install oracle grid ${title}"],
      } -> exec { 'daemon-reload for ohas':
        command => '/bin/systemctl daemon-reload',
      }
      # ->

      # service { 'ohas.service':
      #   ensure => running,
      #   enable => true,
      #   before => Exec["run root.sh grid script ${title}"],
      # }

    }

    exec { "run root.sh grid script ${title}":
      timeout   => 0,
      command   => "${grid_home}/root.sh",
      user      => 'root',
      group     => 'root',
      path      => $exec_path,
      cwd       => $grid_base,
      logoutput => true,
      require   => Exec["install oracle grid ${title}"],
    }

    if ( $version == '12.2.0.1' and $grid_type != 'CRS_SWONLY' ) {
      exec { "configure asm ${title}":
        timeout   => 0,
        command   => "${grid_home}/gridSetup.sh -executeConfigTools -silent -responseFile ${download_dir}/grid_install_${version}.rsp",
        user      => $user,
        group     => $group,
        path      => $exec_path,
        cwd       => $grid_home,
        logoutput => true,
        require   => Exec["install oracle grid ${title}","run root.sh grid script ${title}"],
      }
    }

    if !defined(File[$grid_home]) {
      file { $grid_home:
        ensure  => directory,
        recurse => false,
        replace => false,
        mode    => '0775',
        owner   => $user,
        group   => $group_install,
        require => Exec["install oracle grid ${title}","run root.sh grid script ${title}"],
      }
    }
    # cleanup
    if ( $zip_extract ) {
      if ($version != '12.2.0.1') {
        exec { "remove oracle asm extract folder ${title}":
          command => "rm -rf ${download_dir}/${file_without_ext}",
          user    => 'root',
          group   => 'root',
          path    => $exec_path,
          require => Exec["install oracle grid ${title}"],
        }
      }

      if ( $remote_file == true ){
        if ( $total_files > 1 ) {
          exec { "remove oracle asm file2 ${file2} ${title}":
            command => "rm -rf ${download_dir}/${file2}",
            user    => 'root',
            group   => 'root',
            path    => $exec_path,
            require => Exec["install oracle grid ${title}"],
          }
        }

        exec { "remove oracle asm file1 ${file1} ${title}":
          command => "rm -rf ${download_dir}/${file1}",
          user    => 'root',
          group   => 'root',
          path    => $exec_path,
          require => Exec["install oracle grid ${title}"],
        }
      }
    }

    if ( $grid_type == 'CRS_SWONLY' ) {
      if ( $stand_alone == true ) {
        exec { 'Configuring Grid Infrastructure for a Stand-Alone Server':
          command   => "${grid_home}/perl/bin/perl -I${grid_home}/perl/lib -I${grid_home}/crs/install ${grid_home}/crs/install/roothas.pl",
          user      => 'root',
          group     => 'root',
          path      => $exec_path,
          cwd       => $grid_base,
          logoutput => true,
          require   => [Exec["run root.sh grid script ${title}"],
                        File[$grid_home],],
        }
      }
    } else {
      file { "${download_dir}/cfgrsp.properties":
        ensure  => present,
        content => epp('oradb/grid_password.properties.epp', { 'sys_asm_password' => $sys_asm_password } ),
        mode    => '0600',
        owner   => $user,
        group   => $group,
        require => [Exec["run root.sh grid script ${title}"],
                    File[$grid_home],],
      }

      exec { "run configToolAllCommands grid tool ${title}":
        timeout   => 0, # This can sometimes take a long time
        command   => "${grid_home}/cfgtoollogs/configToolAllCommands RESPONSE_FILE=${download_dir}/cfgrsp.properties",
        user      => $user,
        group     => $group_install,
        path      => $exec_path,
        provider  => 'shell',
        cwd       => "${grid_home}/cfgtoollogs",
        logoutput => true,
        returns   => [0,3], # when a scan adress is not defined in the DNS, it fails, buut we can continue
        require   => [File["${download_dir}/cfgrsp.properties"],
                      Exec["run root.sh grid script ${title}"],
                      Exec["install oracle grid ${title}"],
                      ],
      }
    }

  }
}