Puppet Class: psick::hpsa

Defined in:
manifests/hpsa.pp

Overview

This class manages HP SA client installation and configuration

Parameters:

  • sa_agent_base_url (String) (defaults to: '')

    The base URL (excluded filename) from where to download the HP agent installation file

  • version (String) (defaults to: '65.0.70477.0')

    The version of the HP SA agent package to use

  • sa_agent_file (String) (defaults to: '')

    The name of the file to download. Default is calculated according to OS and version

  • opsw_gw_addr (String) (defaults to: '')

    The string to use to define opsw_gw_addr during registration



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'manifests/hpsa.pp', line 10

class psick::hpsa (
  String $sa_agent_base_url = '',
  String $version           = '65.0.70477.0',
  String $sa_agent_file     = '',
  String $opsw_gw_addr      = '',
) {

  $sa_agent_logfile  = "/var/log/opsware/agent/HPSAagent-${version}_install_verbose.log"

  $solaris_arch = $::architecture ? {
    'x86_64' => '-X86',
    default  => '',
  }
  $real_sa_agent_file = $sa_agent_file ? {
    ''      => $::operatingsystem ? {
      'RedHat'      => "opsware-agent-${version}-linux-${::operatingsystemmajrelease}SERVER-X86_64",
      'OracleLinux' => "opsware-agent-${version}-linux-OEL${::operatingsystemmajrelease}-X86_64",
      'SLES'        => "opsware-agent-${version}-linux-SLES-${::operatingsystemmajrelease}-X86_64",
      'Ubuntu'      => "opsware-agent-${version}-linux-UBUNTU-${::operatingsystemmajrelease}-X86_64",
      'Solaris'     => "opsware-agent-${version}-solaris-${::operatingsystemmajrelease}${solaris_arch}",
    },
    default => $sa_agent_file,
  }

  # HP SA Setup
  if $sa_agent_base_url != '' and $opsw_gw_addr != '' {
    archive { "/usr/local/bin/${real_sa_agent_file}":
      source => "${sa_agent_base_url}/${real_sa_agent_file}",
      notify => Exec['SA agent permissions'],
    }
    exec { 'SA agent permissions':
      command     => "chmod 700 /usr/local/bin/${real_sa_agent_file}",
      refreshonly => true,
      notify      => Exec['SA registration'],
    }
    exec { 'SA registration':
      timeout => 600,
      command => "/usr/local/bin/${real_sa_agent_file} -s -f --opsw_gw_addr ${opsw_gw_addr} --force_sw_reg --loglevel trace --logfile ${sa_agent_logfile} --force_new_device 2>&1",
      creates => '/opt/opsware/agent/bin/python',
    }
    service { 'opsware-agent':
      ensure  => running,
      enable  => true,
      require => Exec['SA registration'],
    }
  }
}