Defined Type: ora_install::client

Defined in:
manifests/client.pp

Summary

Installs the Oracle client software.

Overview

ora_install::client

Using this defined type you can install the Oracle client software on your system.

Here is an example on how to use it:

“‘puppet ora_install::client{ ’12.1.0.1_Linux-x86-64’:

version                   => '12.1.0.1',
file                      => 'linuxamd64_12c_client.zip',
oracle_base               => '/oracle',
oracle_home               => '/oracle/product/12.1/client',
user                      => 'oracle',
group                     => 'dba',
group_install             => 'oinstall',
download_dir              => '/install',
bash_profile              => true,
puppet_download_mnt_point => "puppet:///modules/ora_install/",
ora_inventory_dir         => '/oracle/product',
logoutput                 => true,

} “‘

### support for multiple versions

This defined type has support for installing different versions of the client software on your system. In order to do this use the defined type multiple times in you manifest and use a different ‘oracle_home` and a different `file`.

See the file “LICENSE” for the full license governing this code.

Parameters:

  • bash_profile (Boolean) (defaults to: true)

    Create a bash profile for the specified user or not. Valid values are ‘true` and `false`. When you specify a `true` for the parameter, Puppet will create a standard bash profile for the specified user. The bash profile will be placed in a directory named `user_base_dir/user`. “`puppet ora_install::client { ’Oracle client’:

    ...
    bash_profile  => true,
    user          => 'oracle',
    user_base_dir => '/home',
    ...
    

    } “‘ This snippet will create a bash profile called `/home/oracle/.bash_profile`.

  • db_port (Integer) (defaults to: 1521)

    The IP port to use for database communication. The default value is: ‘1521`

  • download_dir (Stdlib::Absolutepath) (defaults to: '/install')

    The directory where the Puppet software puts all downloaded files. Before Puppet can actually use remote files, they must be downloaded first. Puppet uses this directory to put all files in. The default value is: ‘/install`

  • file (String[1]) (defaults to: undef)

    The source file to use.

  • group (String[1]) (defaults to: 'dba')

    The os group to use for these Oracle puppet definitions. The default value is: ‘dba`

  • group_install (String[1]) (defaults to: 'oinstall')

    The os group to use for installation. The default value is: ‘oinstall`

  • logoutput (Variant[Boolean,Enum['on_failure']]) (defaults to: lookup({ name => 'logoutput', default_value => 'on_failure' }))

    log the outputs of Puppet exec or not. When you specify ‘true` Puppet will log all output of `exec` types. Valid values are:

    • ‘true`

    • ‘false`

    • ‘on_failure`

  • ora_inventory_dir (Optional[Stdlib::Absolutepath]) (defaults to: undef)

    The directory that contains the oracle inventory. The default value is: ‘/oracle_base/oraInventory`

  • oracle_base (Stdlib::Absolutepath) (defaults to: undef)

    A directory to use as Oracle base directory.

  • oracle_home (Stdlib::Absolutepath) (defaults to: undef)

    A directory to be used as Oracle home directory for this software.

  • puppet_download_mnt_point (Optional[String[1]]) (defaults to: undef)

    The base path of all remote files for the defined type or class. The default value is: ‘puppet:///modules/ora_install`

  • temp_dir (Stdlib::Absolutepath) (defaults to: '/tmp')

    Directory to use for temporary files.

  • umask (String[1]) (defaults to: '0022')

    The umask to use for commands that run in the context of either the grid user or the oracle user. The default is ‘0022`

  • user (String[1]) (defaults to: 'oracle')

    The user used for the specified installation. The install class will not create the user for you. You must do that yourself. The default value is: ‘oracle`

  • user_base_dir (Stdlib::Absolutepath) (defaults to: '/home')

    The directory to use as base directory for the users.

  • version (Ora_install::Version) (defaults to: undef)

    The version that is installed in the used Oracle home. Puppet uses this value to decide on version specific actions.

  • allow_insecure (Boolean) (defaults to: lookup({ name => 'allow_insecure', default_value => false }))

    When set to ‘true` Ignore HTTPS certificate errors (default: false)

  • install_type (Enum['Administrator','Runtime','InstantClient','Custom']) (defaults to: 'Administrator')

    Installation type of the Oracle client. The following choices are available. The value should contain only one of these choices:

    - Administrator
    - Runtime
    - InstantClient
    - Custom
    

    The default is administrator.

  • install_options (Array[String]) (defaults to: [])

    The list of Client Components you would like to install. This property is considered only if INSTALL_TYPE is set to “Custom”

    The following choices are available. You may specify any combination of these choices. The components you choose should be specified in the form “internal-component-name:version” Below is a list of components you may specify to install for Oracle 21.

    • oracle.sqlj:21.0.0.0.0 – “Oracle SQLJ”

    • oracle.rdbms.util:21.0.0.0.0 – “Oracle Database Utilities”

    • oracle.javavm.client:21.0.0.0.0 – “Oracle Java Client”

    • oracle.sqlplus:21.0.0.0.0 – “SQL*Plus”

    • oracle.dbjava.jdbc:21.0.0.0.0 – “Oracle JDBC/THIN Interfaces”

    • oracle.ldap.client:21.0.0.0.0 – “Oracle Internet Directory Client”

    • oracle.rdbms.oci:21.0.0.0.0 – “Oracle Call Interface (OCI)”

    • oracle.precomp:21.0.0.0.0 – “Oracle Programmer”

    • oracle.xdk:21.0.0.0.0 – “Oracle XML Development Kit”

    • oracle.network.aso:21.0.0.0.0 – “Oracle Advanced Security”

    • oracle.oraolap.mgmt:21.0.0.0.0 – “OLAP Analytic Workspace Manager and Worksheet”

    • oracle.network.client:21.0.0.0.0 – “Oracle Net”

    • oracle.network.cman:21.0.0.0.0 – “Oracle Connection Manager”

    • oracle.network.listener:21.0.0.0.0 – “Oracle Net Listener”

    • oracle.ordim.client:21.0.0.0.0 – “Oracle Multimedia Client Option”

    • oracle.odbc:21.0.0.0.0 – “Oracle ODBC Driver”

    • oracle.dbdev:21.0.0.0.0 – “Oracle SQL Developer”

    • oracle.rdbms.scheduler:21.0.0.0.0 – “Oracle Scheduler Agent”

    • oracle.rdbms.drdaas:21.0.0.0.0 – “Oracle Database Provider for DRDA”

  • architecture (Enum['client32','client']) (defaults to: 'client')

    The type of architecture client you want to install. This MUST match the file you are provinding to the installed. Valid values are:

    • ‘client`

    • ‘client32`

    The default is ‘client`



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
# File 'manifests/client.pp', line 157

define ora_install::client (
  # lint:ignore:strict_indent
  Ora_install::Version                $version                   = undef,
  String[1]                           $file                      = undef,
  Stdlib::Absolutepath                $oracle_base               = undef,
  Stdlib::Absolutepath                $oracle_home               = undef,
  Integer                             $db_port                   = 1521,
  String[1]                           $umask                     = '0022',
  String[1]                           $user                      = 'oracle',
  Stdlib::Absolutepath                $user_base_dir             = '/home',
  String[1]                           $group                     = 'dba',
  String[1]                           $group_install             = 'oinstall',
  Stdlib::Absolutepath                $download_dir              = '/install',
  Stdlib::Absolutepath                $temp_dir                  = '/tmp',
  Enum['client32','client']           $architecture              = 'client',
  Enum['Administrator','Runtime','InstantClient','Custom']
                                      $install_type              = 'Administrator',
  Array[String]                       $install_options           = [],
  Boolean                             $bash_profile              = true,
  Optional[String[1]]                 $puppet_download_mnt_point = undef,
  Optional[Stdlib::Absolutepath]      $ora_inventory_dir         = undef,
  Variant[Boolean,Enum['on_failure']] $logoutput                 = lookup({ name => 'logoutput', default_value => 'on_failure' }),
  Boolean                             $allow_insecure            = lookup({ name => 'allow_insecure', default_value => false }),
  # lint:endignore:strict_indent
) {
  ora_install { $title: ensure => 'present' }

  if ( $ora_inventory_dir ) {
    $ora_inventory = "${ora_inventory_dir}/oraInventory"
  } else {
    $ora_inventory = "${oracle_base}/oraInventory"
  }

  easy_type::debug_evaluation() # Show local variable on extended debug

  db_directory_structure { "client structure ${version}":
    ensure            => present,
    oracle_base_dir   => $oracle_base,
    ora_inventory_dir => $ora_inventory,
    download_dir      => $download_dir,
    os_user           => $user,
    os_group          => $group_install,
  }

  unless ( ora_install::oracle_exists( $oracle_home ) ) {
    $exec_path     = '/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:'

    if ( $puppet_download_mnt_point ) {
      $mount_point     = $puppet_download_mnt_point
    } else {
      $mount_point     = 'puppet:///modules/ora_install/'
    }

    if ( $mount_point == $download_dir ) {
      $archive_cleanup = false
    } else {
      $archive_cleanup = true
    }

    file { "${download_dir}/client_${version}":
      ensure => directory,
      owner  => $user,
      group  => $group,
      mode   => '0775',
    }

    archive { "${download_dir}/${file}":
      ensure         => present,
      allow_insecure => $allow_insecure,
      cleanup        => $archive_cleanup,
      creates        => "${download_dir}/client_${version}/client",
      extract        => true,
      extract_path   => "${download_dir}/client_${version}",
      group          => $group,
      require        => File["${download_dir}/client_${version}"],
      source         => "${mount_point}/${file}",
      temp_dir       => $temp_dir,
      user           => $user,
    }

    ora_install::utils::dborainst { "oracle orainst ${version}":
      ora_inventory_dir => $ora_inventory,
      os_group          => $group_install,
      os_user           => $user,
    }

    unless ( defined(File["${download_dir}/db_client_${version}.rsp"]) ) {
      file { "${download_dir}/db_client_${version}.rsp":
        ensure  => file,
        content => epp("ora_install/db_client_${version}.rsp.epp",
          {
            'oracle_home'     => $oracle_home,
            'oracle_base'     => $oracle_base,
            'ora_inventory'   => $ora_inventory,
            'install_type'    => $install_type,
            'group_install'   => $group_install,
            'install_options' => $install_options
        }),
        mode    => '0775',
        owner   => $user,
        group   => $group,
        require => [Ora_install::Utils::Dborainst["oracle orainst ${version}"],
        Db_directory_structure["client structure ${version}"],],
      }
    }

    exec { "install oracle client ${title}":
      command     => "/bin/sh -c 'unset DISPLAY;${download_dir}/client_${version}/${architecture}/runInstaller -silent -waitforcompletion -ignoreSysPrereqs -ignorePrereq -responseFile ${download_dir}/db_client_${version}.rsp'",
      require     => [
        Ora_install::Utils::Dborainst["oracle orainst ${version}"],
        File["${download_dir}/db_client_${version}.rsp"],
        Archive["${download_dir}/${file}"]
      ],
      creates     => $oracle_home,
      environment => [
        "TMP=${temp_dir}",
        "TMPDIR=${temp_dir}",
        "TEMP=${temp_dir}",
        'CV_ASSUME_DISTID=OL7',
      ],
      timeout     => 0,
      returns     => [6,0],
      path        => $exec_path,
      umask       => $umask,
      user        => $user,
      group       => $group_install,
      logoutput   => $logoutput,
    }

    exec { "run root.sh script ${title}":
      command   => "${oracle_home}/root.sh",
      user      => 'root',
      group     => 'root',
      require   => Exec["install oracle client ${title}"],
      path      => $exec_path,
      logoutput => $logoutput,
    }

    if $install_type == 'Administrator' {
      file { "${download_dir}/netca_client_${version}.rsp":
        ensure  => file,
        content => epp("ora_install/netca_client_${version}.rsp.epp",
          {
            'db_port' => $db_port,
        }),
        require => Exec["run root.sh script ${title}"],
        mode    => '0775',
        owner   => $user,
        group   => $group,
      }

      exec { "install oracle net ${title}":
        command   => "${oracle_home}/bin/netca /silent /responsefile ${download_dir}/netca_client_${version}.rsp",
        require   => [File["${download_dir}/netca_client_${version}.rsp"],Exec["run root.sh script ${title}"],],
        creates   => "${oracle_home}/network/admin/sqlnet.ora",
        path      => $exec_path,
        umask     => $umask,
        user      => $user,
        group     => $group,
        logoutput => $logoutput,
      }

      # cleanup
      cleanup { "remove oracle client extract folder ${title}":
        file_name => "${download_dir}/client_${version}",
      }
    }

    if ( $bash_profile ) {
      unless ( defined(File["${user_base_dir}/${user}/.bash_profile"]) ) {
        file { "${user_base_dir}/${user}/.bash_profile":
          ensure  => file,
          content => regsubst(epp('ora_install/bash_profile.epp',
              {
                'oracle_home'    => $oracle_home,
                'oracle_base'    => $oracle_base,
                'bash_additions' => ''
          }), '\r\n', "\n", 'EMG'),
          mode    => '0775',
          owner   => $user,
          group   => $group,
        }
      }
    }

    if ( $archive_cleanup ) {
      cleanup { "${download_dir}/${file}":
      }
    }
  }
}