Puppet Class: sensu::cli
- Defined in:
- manifests/cli.pp
Summary
Manage Sensu CLIOverview
Class to manage the Sensu CLI.
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 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 |
# File 'manifests/cli.pp', line 30
class sensu::cli (
Optional[String] $version = undef,
String $package_name = 'sensu-go-cli',
Optional[Variant[Stdlib::HTTPSUrl, Stdlib::HTTPUrl, Pattern[/^(file|puppet):/]]] $install_source = undef,
Optional[Stdlib::Absolutepath] $install_path = undef,
Boolean $configure = true,
Optional[Integer] $sensuctl_chunk_size = undef,
Optional[Enum['tabular','json','wrapped-json','yaml']] $config_format = undef,
Optional[String] $config_namespace = undef,
) {
include sensu
include sensu::common
$_version = pick($version, $sensu::version)
if $sensu::use_ssl and $configure {
Class['sensu::ssl'] -> Sensuctl_configure['puppet']
}
if $facts['os']['family'] == 'windows' {
if ! $install_source {
fail('sensu::cli: install_source is required for Windows')
}
$sensuctl_path = "${install_path}\\sensuctl.exe"
file { $install_path:
ensure => 'directory',
}
archive { 'sensu-go-cli.zip':
path => "${install_path}\\sensu-go-cli.zip",
source => $install_source,
extract => true,
extract_path => $install_path,
creates => "${install_path}\\sensuctl.exe",
cleanup => false,
require => File[$install_path],
}
windows_env { 'sensuctl-path':
ensure => 'present',
variable => 'PATH',
value => $install_path,
mergemode => 'append',
require => Archive['sensu-go-cli.zip'],
}
} else {
$sensuctl_path = undef
package { 'sensu-go-cli':
ensure => $_version,
name => $package_name,
require => $sensu::package_require,
}
}
if $configure {
sensuctl_config { 'sensu':
chunk_size => $sensuctl_chunk_size,
path => $sensuctl_path,
validate_namespaces => $sensu::validate_namespaces,
}
sensuctl_configure { 'puppet':
url => $sensu::api_url,
username => 'admin',
password => $sensu::password,
trusted_ca_file => $sensu::trusted_ca_file,
config_format => $config_format,
config_namespace => $config_namespace,
}
}
}
|