Defined Type: oradb::installem_agent

Defined in:
manifests/installem_agent.pp

Overview

installem_agent

install the enterprise manager agent

Examples:

em agent install


oradb::installem_agent{ 'em12104_agent':
    version                     => '12.1.0.4',
    source                      => 'https://10.10.10.25:7802/em/install/getAgentImage',
    install_type                => 'agentPull',
    install_platform            => 'Linux x86-64',
    oracle_base_dir             => '/oracle',
    agent_base_dir              => '/oracle/product/12.1/agent',
    agent_instance_home_dir     => '/oracle/product/12.1/agent/agent_inst',
    sysman_user                 => 'sysman',
    sysman_password             => 'Welcome01',
    agent_registration_password => 'Welcome01',
    agent_port                  => 1830,
    oms_host                    => '10.10.10.25',
    oms_port                    => 7802,
    em_upload_port              => 4903,
    user                        => 'oracle',
    group                       => 'dba',
    download_dir                => '/var/tmp/install',
    log_output                  => true,
    oracle_hostname             => 'emdb.example.com',
}

oradb::installem_agent{ 'em12104_agent2':
    version                     => '12.1.0.4',
    source                      => '/var/tmp/install/agent.zip',
    install_type                => 'agentDeploy',
    oracle_base_dir             => '/oracle',
    agent_base_dir              => '/oracle/product/12.1/agent2',
    agent_instance_home_dir     => '/oracle/product/12.1/agent2/agent_inst',
    agent_registration_password => 'Welcome01',
    agent_port                  => 1832,
    oms_host                    => '10.10.10.25',
    em_upload_port              => 4903,
    user                        => 'oracle',
    group                       => 'dba',
    download_dir                => '/var/tmp/install',
    log_output                  => true,
}

Parameters:

  • version (Enum['12.1.0.4', '12.1.0.5', '13.2.0.0']) (defaults to: '12.1.0.5')

    Oracle installation EM version

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

    full path to the Oracle Base directory

  • agent_base_dir (String) (defaults to: undef)

    full path to the Oracle Agent Home directory inside Oracle Base

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

    full path to the Oracle Inventory location directory

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

    operating system user

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

    the operating group name for using the oracle software# @param group_install the operating group name for the installed software

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

    location for installation files used by this module

  • log_output (Boolean) (defaults to: false)

    log all output

  • install_version (String) (defaults to: '12.1.0.5.0')

    EM agent version

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

    EM agent OS install

  • source (String) (defaults to: undef)

    url or local install file

  • agent_instance_home_dir (String) (defaults to: undef)

    oracle em agent home

  • agent_registration_password (String) (defaults to: undef)

    em registration password

  • agent_port (Integer) (defaults to: 1830)

    agent listen port

  • sysman_user (String) (defaults to: 'sysman')

    sysman username

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

    sysman user password

  • oms_host (String) (defaults to: undef)

    oms host

  • oms_port (Integer) (defaults to: undef)

    oms port number

  • em_upload_port (Integer) (defaults to: undef)

    em upload port

  • oracle_hostname (String) (defaults to: undef)

    the FQDN hostname to install the agent on

  • manage_curl (Boolean) (defaults to: true)

    download curl package



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

define oradb::installem_agent(
  Enum['12.1.0.4', '12.1.0.5', '13.2.0.0'] $version  = '12.1.0.5',
  Enum['agentPull', 'agentDeploy'] $install_type     = undef,
  String $install_version                            = '12.1.0.5.0',
  String $install_platform                           = 'Linux x86-64',
  String $source                                     = undef, # 'https://<OMS_HOST>:<OMS_PORT>/em/install/getAgentImage'|'/tmp/12.1.0.4.0_AgentCore_226_Linux_x64.zip'
  Optional[String] $ora_inventory_dir                = undef,
  String $oracle_base_dir                            = undef,
  String $agent_base_dir                             = undef,
  String $agent_instance_home_dir                    = undef,
  String $agent_registration_password                = undef,
  Integer $agent_port                                = 1830,
  String $sysman_user                                = 'sysman',
  Optional[String] $sysman_password                  = undef,
  String $oms_host                                   = undef, # 'emapp.example.com'
  Integer $oms_port                                  = undef, # 7802
  Integer $em_upload_port                            = undef, # 14511
  String $user                                       = lookup('oradb::user'),
  String $group                                      = lookup('oradb::group_install'),
  String $download_dir                               = lookup('oradb::download_dir'),
  Boolean $log_output                                = false,
  String $oracle_hostname                            = undef, # FQDN hostname where to install on
  Boolean $manage_curl                               = true,
)
{

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

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

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

  # 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,
  }

  if ( $continue ) {

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

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

    if ( $source == undef or is_string($source) == false) {fail('You must specify source') }
    if ( $agent_base_dir == undef or is_string($agent_base_dir) == false) {fail('You must specify agent_base_dir') }
    if ( $oracle_base_dir == undef or is_string($oracle_base_dir) == false) {fail('You must specify oracle_base_dir') }
    if ( $agent_registration_password == undef or is_string($agent_registration_password) == false) {fail('You must specify agent_registration_password') }
    if ( $em_upload_port == undef or is_numeric($em_upload_port) == false) {fail('You must specify em_upload_port') }

    # chmod +x /tmp/AgentPull.sh
    if ( $install_type  == 'agentPull') {

      if ( $sysman_user == undef or is_string($sysman_user) == false) {fail('You must specify sysman_user') }
      if ( $sysman_password == undef or is_string($sysman_password) == false) {fail('You must specify sysman_password') }

      if $manage_curl and !defined(Package['curl']) {
        package { 'curl':
          ensure => present,
        }
      }

      exec { "agentPull ${title}":
        command   => "curl ${source} --insecure -o ${download_dir}/AgentPull.sh",
        timeout   => 0,
        logoutput => $log_output,
        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 => $log_output,
        path      => $exec_path,
        user      => $user,
        group     => $group,
        require   => Exec["agentPull ${title}"],
      }

      file { "${download_dir}/em_agent.properties":
        ensure  => present,
        content => epp('oradb/em_agent_pull.properties.epp', {
                        '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,
                        'agent_registration_password' => $agent_registration_password,
                        'agent_base_dir'              => $agent_base_dir }),
        mode    => '0755',
        owner   => $user,
        group   => $group,
        require => Db_directory_structure["oracle em agent structure ${version}"],
      }

      $command = "${download_dir}/AgentPull.sh LOGIN_USER=${sysman_user} LOGIN_PASSWORD=${sysman_password} PLATFORM=\"${install_platform}\" VERSION=${install_version} AGENT_BASE_DIR=${agent_base_dir} AGENT_REGISTRATION_PASSWORD=${agent_registration_password} ORACLE_HOSTNAME=${oracle_hostname} RSPFILE_LOC=${download_dir}/em_agent.properties"

      exec { "agentPull execute ${title}":
        command   => $command,
        timeout   => 0,
        logoutput => $log_output,
        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}"],
                      Oradb::Utils::Dborainst["em agent orainst ${version}"],],
      }

      if ($version in ['13.2.0.0']) {
        $after_command = "${agent_base_dir}/agent_${install_version}/root.sh"
      } else {
        $after_command = "${agent_base_dir}/core/${install_version}/root.sh"
      }

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

    } elsif ( $install_type  == 'agentDeploy') {

      if !defined(Package['unzip']) {
        package { 'unzip':
          ensure => present,
        }
      }

      exec { "extract ${source} ${title}":
        command   => "unzip -o ${source} -d ${download_dir}/em_agent_${version}",
        timeout   => 0,
        logoutput => false,
        path      => $exec_path,
        user      => $user,
        group     => $group,
        require   => [Db_directory_structure["oracle em agent structure ${version}"],
                      Oradb::Utils::Dborainst["em agent orainst ${version}"],],
      }

      if ( $agent_instance_home_dir == undef ) {
        $command = "${download_dir}/em_agent_${version}/agentDeploy.sh AGENT_BASE_DIR=${agent_base_dir} AGENT_REGISTRATION_PASSWORD=${agent_registration_password} OMS_HOST=${oms_host} AGENT_PORT=${agent_port} EM_UPLOAD_PORT=${em_upload_port}"
      } else {
        $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} OMS_HOST=${oms_host} AGENT_PORT=${agent_port} EM_UPLOAD_PORT=${em_upload_port}"
      }

      exec { "agentDeploy execute ${title}":
        command   => $command,
        timeout   => 0,
        logoutput => $log_output,
        path      => $exec_path,
        user      => $user,
        group     => $group,
        require   => [Exec["extract ${source} ${title}"],
                      Db_directory_structure["oracle em agent structure ${version}"],
                      Oradb::Utils::Dborainst["em agent orainst ${version}"],],
      }

      if ($version in ['13.2.0.0']) {
        $after_command = "${agent_base_dir}/agent_${install_version}/root.sh"
      } else {
        $after_command = "${agent_base_dir}/core/${install_version}/root.sh"
      }

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

    } else {
      fail('Unrecognized install_type, use agentDeploy or agentPull' )
    }
  }
}