Defined Type: ora_install::installem_agent

Defined in:
manifests/installem_agent.pp

Summary

Installs the Oracle Enterprise Manager Agent.

Overview

ora_install::installem_agent

This defined type supports the following versions of Enterprise Manager:

  • 12.1.0.4

  • 12.1.0.5

  • 13.1.0.0

  • 13.2.0.0

  • 13.3.0.0

  • 13.3.0.0

  • 13.4.0.0

  • 13.5.0.0

Here is an example:

“‘puppet ora_install::installem_agent{ ’Install em agent’:

version                     => '13.2.0.0',
install_type                => 'agentPull',
install_version             => '13.2.0.0.0',
oracle_base_dir             => '/u01/app',
agent_base_dir              => '/u01/app/agent/product',
agent_instance_home_dir     => '/u01/app/agent/product/agent_inst',
agent_registration_password => 'regme',
agent_port                  => 3872,
sysman_password             => 'Welkom01',
oms_host                    => 'em1320.example.com',
oms_port                    => 7799,
em_upload_port              => 1159,
logoutput                   => true,

} “‘

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

Parameters:

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

    The directory to use as base for the agent software.

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

    The directory to use as instance home.

  • agent_port (Integer) (defaults to: 1830)

    The IP port to use to for the agent. The default value is: ‘3872`

  • agent_registration_password (Optional[Easy_type::Password]) (defaults to: undef)

    The password to use to register the agent.

  • 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`

  • em_upload_port (Integer) (defaults to: undef)

    The port number of the HTTP port for the upload service. The default value is: ‘1159`

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

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

  • install_platform (String[1]) (defaults to: 'Linux x86-64')

    The type of platform you want to install. The default value is: ‘Linux x86-64`

  • install_type (Enum['agentPull','agentDeploy']) (defaults to: undef)

    The type of install. valid values are:

    • ‘undefined`

    • ‘agentPull`

    • ‘agentDeploy`

    The default value is: ‘undefined`

  • install_version (Enum[ '12.1.0.4.0', '12.1.0.5.0', '13.1.0.0.0', '13.2.0.0.0', '13.3.0.0.0', '13.4.0.0.0', '13.5.0.0.0']) (defaults to: '12.1.0.5.0')

    The version you want to install. The default value is: ‘12.1.0.5.0`

  • 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`

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

    The OMS host to use.

  • oms_port (Integer) (defaults to: undef)

    The IP port to use for connecting to the OMS host.

  • 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_dir (Stdlib::Absolutepath) (defaults to: undef)

    A directory to use as Oracle base directory.

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

    The source to use for the installation of the EM agent. Valid values are:

    • an URL like: ‘https://<OMS_HOST>:<OMS_PORT>/em/install/getAgentImage`

    • a local file like: ‘/tmp/12.1.0.4.0_AgentCore_226_Linux_x64.zip`

  • sysman_password (Optional[Easy_type::Password]) (defaults to: undef)

    The password to use for sysman.

  • sysman_user (String[1]) (defaults to: 'sysman')

    The sysman user. The default value is: ‘sysman`

  • 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`

  • version (Enum[ '12.1.0.4', '12.1.0.5', '13.1.0.0', '13.2.0.0', '13.3.0.0', '13.4.0.0', '13.5.0.0']) (defaults to: '12.1.0.5')

    The agent version to be installed

    • ‘12.1.0.4`

    • ‘12.1.0.5`

    • ‘13.1.0.0`

    • ‘13.2.0.0`

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

    Directory to use for temporary files.

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

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



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

define ora_install::installem_agent (
  Optional[Easy_type::Password]                 $agent_registration_password = undef,
  Optional[Easy_type::Password]                 $sysman_password             = undef,
  # lint:ignore:strict_indent
  Enum[
    '12.1.0.4',
    '12.1.0.5',
    '13.1.0.0',
    '13.2.0.0',
    '13.3.0.0',
    '13.4.0.0',
    '13.5.0.0']                                 $version                     = '12.1.0.5',
  Enum['agentPull','agentDeploy']               $install_type                = undef,
  Enum[
    '12.1.0.4.0',
    '12.1.0.5.0',
    '13.1.0.0.0',
    '13.2.0.0.0',
    '13.3.0.0.0',
    '13.4.0.0.0',
    '13.5.0.0.0']                               $install_version             = '12.1.0.5.0',
  # lint:endignore:strict_indent
  String[1]                                     $install_platform            = 'Linux x86-64',
  Optional[String[1]]                           $source                      = undef, # 'https://<OMS_HOST>:<OMS_PORT>/em/install/getAgentImage'|'/tmp/12.1.0.4.0_AgentCore_226_Linux_x64.zip'
  Optional[Stdlib::Absolutepath]                $ora_inventory_dir           = undef,
  Stdlib::Absolutepath                          $oracle_base_dir             = undef,
  Stdlib::Absolutepath                          $agent_base_dir              = undef,
  Optional[Stdlib::Absolutepath]                $agent_instance_home_dir     = undef,
  Integer                                       $agent_port                  = 1830,
  String[1]                                     $sysman_user                 = 'sysman',
  String[1]                                     $oms_host                    = undef,
  Integer                                       $oms_port                    = undef,
  Integer                                       $em_upload_port              = undef,
  String[1]                                     $user                        = 'oracle',
  String[1]                                     $group                       = 'oinstall',
  Stdlib::Absolutepath                          $download_dir                = '/install',
  Stdlib::Absolutepath                          $temp_dir                    = '/tmp',
  # lint:ignore:manifest_whitespace_opening_brace_before
  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:manifest_whitespace_opening_brace_before
) {
  ora_install { $title: ensure => 'present' }

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

  if ( $version in ['12.1.0.4', '12.1.0.5']) {
    $agent_home = "${agent_base_dir}/core/${install_version}"
  } else {
    $agent_home = "${agent_base_dir}/agent_${install_version}"
  }

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

  # setup oracle base with the right permissions
  db_directory_structure { "oracle em agent structure ${version}":
    ensure            => present,
    oracle_base_dir   => $oracle_base_dir,
    ora_inventory_dir => $ora_inventory,
    download_dir      => $download_dir,
    os_user           => $user,
    os_group          => $group,
  }

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

    # check oraInst
    ora_install::utils::dborainst { "em agent orainst ${version}":
      ora_inventory_dir => $ora_inventory,
      os_group          => $group,
      os_user           => $user,
    }

    if ( $source ) {
      $source_loc = $source
    } else {
      $source_loc = "https://${oms_host}:${em_upload_port}/em/install/getAgentImage"
    }

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

    unless ( defined(Package['zip']) ) {
      package { 'zip':
        ensure  => present,
      }
    }

    # chmod +x /tmp/AgentPull.sh
    if ( $install_type  == 'agentPull') {
      if ( $sysman_password.unwrap == undef or $sysman_password.unwrap !~ String ) { fail('You must specify sysman_password') }
      unless ( defined(Package['curl']) ) {
        package { 'curl':
          ensure  => present,
        }
      }

      exec { "agentPull ${title}":
        command   => "curl ${source_loc} --insecure -o ${download_dir}/AgentPull.sh",
        timeout   => 0,
        logoutput => $logoutput,
        path      => $exec_path,
        user      => $user,
        group     => $group,
        require   => [
          Package['curl'],
          Db_directory_structure["oracle em agent structure ${version}"],
        ],
      }

      exec { "chmod ${title}":
        command   => "chmod +x ${download_dir}/AgentPull.sh",
        timeout   => 0,
        logoutput => $logoutput,
        path      => $exec_path,
        user      => $user,
        group     => $group,
        require   => Exec["agentPull ${title}"],
      }

      file { "${download_dir}/em_agent.properties":
        ensure    => file,
        content   => epp('ora_install/em_agent_pull.properties.epp',
          {
            'sysman_user'                 => $sysman_user,
            'sysman_password'             => $sysman_password,
            'install_platform'            => $install_platform,
            'agent_registration_password' => $agent_registration_password,
            'agent_base_dir'              => $agent_base_dir,
            'agent_instance_home_dir'     => $agent_instance_home_dir,
            'oms_host'                    => $oms_host,
            'oms_port'                    => $oms_port,
            'agent_port'                  => $agent_port,
            'em_upload_port'              => $em_upload_port,
        }),
        mode      => '0755',
        owner     => $user,
        group     => $group,
        show_diff => false,
        require   => Db_directory_structure["oracle em agent structure ${version}"],
      }

      $command = "${download_dir}/AgentPull.sh RSPFILE_LOC=${download_dir}/em_agent.properties OMS_HOST=${oms_host} OMS_PORT=${oms_port}"

      exec { "agentPull execute ${title}":
        command     => $command,
        timeout     => 0,
        environment => ["TMP=${temp_dir}","TMPDIR=${temp_dir}","TEMP=${temp_dir}"],
        logoutput   => $logoutput,
        path        => $exec_path,
        user        => $user,
        group       => $group,
        require     => [
          Exec["agentPull ${title}"],
          Exec["chmod ${title}"],
          File["${download_dir}/em_agent.properties"],
          Db_directory_structure["oracle em agent structure ${version}"],
          Ora_install::Utils::Dborainst["em agent orainst ${version}"],
        ],
      }

      exec { "run em agent root.sh script ${title}":
        command   => "${agent_home}/root.sh",
        user      => 'root',
        group     => 'root',
        path      => $exec_path,
        cwd       => $agent_base_dir,
        logoutput => $logoutput,
        require   => Exec["agentPull execute ${title}"],
      }
    } elsif ( $install_type  == 'agentDeploy') {
      unless ( $source ) { fail('You must specify source when using install_type => \'agentDeploy\'') }

      file { "${download_dir}/em_agent_${version}":
        ensure  => directory,
        owner   => $user,
        group   => $group,
        mode    => '0755',
        require => Db_directory_structure["oracle em agent structure ${version}"],
      }

      $basename_source = split($source_loc, '/')[-1]

      archive { "${download_dir}/${basename_source}":
        ensure         => present,
        allow_insecure => $allow_insecure,
        before         => Exec["agentDeploy execute ${title}"],
        cleanup        => $archive_cleanup,
        extract        => true,
        extract_path   => "${download_dir}/em_agent_${version}",
        group          => $group,
        require        => File["${download_dir}/em_agent_${version}"],
        source         => $source_loc,
        user           => $user,
      }

      if ( $agent_instance_home_dir ) {
        $command = "${download_dir}/em_agent_${version}/agentDeploy.sh AGENT_BASE_DIR=${agent_base_dir} AGENT_INSTANCE_HOME=${agent_instance_home_dir} AGENT_REGISTRATION_PASSWORD=${agent_registration_password.unwrap} OMS_HOST=${oms_host} AGENT_PORT=${agent_port} EM_UPLOAD_PORT=${em_upload_port} SCRATCHPATH=${temp_dir}"
      } else {
        $command = "${download_dir}/em_agent_${version}/agentDeploy.sh AGENT_BASE_DIR=${agent_base_dir} AGENT_REGISTRATION_PASSWORD=${agent_registration_password.unwrap} OMS_HOST=${oms_host} AGENT_PORT=${agent_port} EM_UPLOAD_PORT=${em_upload_port} SCRATCHPATH=${temp_dir}"
      }

      exec { "agentDeploy execute ${title}":
        command     => $command,
        cwd         => $temp_dir,
        timeout     => 0,
        environment => ["TMP=${temp_dir}","TMPDIR=${temp_dir}","TEMP=${temp_dir}"],
        logoutput   => $logoutput,
        path        => $exec_path,
        user        => $user,
        group       => $group,
        require     => [
          Archive["${download_dir}/${basename_source}"],
          Db_directory_structure["oracle em agent structure ${version}"],
          Ora_install::Utils::Dborainst["em agent orainst ${version}"],
        ],
      }

      exec { "run em agent root.sh script ${title}":
        command   => "${agent_home}/root.sh",
        user      => 'root',
        group     => 'root',
        path      => $exec_path,
        cwd       => $agent_base_dir,
        logoutput => $logoutput,
        require   => Exec["agentDeploy execute ${title}"],
      }
    }
  }
}