Puppet Class: cassandra::datastax_agent

Inherits:
cassandra::params
Defined in:
manifests/datastax_agent.pp

Overview

A class for installing the DataStax Agent and to point it at an OpsCenter instance.

Examples:

Set agent_alias to foobar, stomp_interface to localhost and ensure that async_pool_size is absent from the file.

class { 'cassandra::datastax_agent':
  settings => {
    'agent_alias'     => {
      'setting' => 'agent_alias',
      'value'   => 'foobar',
    },
    'stomp_interface' => {
      'setting' => 'stomp_interface',
      'value'   => 'localhost',
    },
    'async_pool_size' => {
      'ensure' => absent,
    },
  },
}

Parameters:

  • address_config_file (Any) (defaults to: '/var/lib/datastax-agent/conf/address.yaml')

    The full path to the address config file.

  • defaults_file (Any) (defaults to: '/etc/default/datastax-agent')

    The full path name to the file where ‘java_home` is set.

  • java_home (Any) (defaults to: undef)

    If the value of this variable is left as undef, no action is taken. Otherwise the value is set as JAVA_HOME in ‘defaults_file`.

  • package_ensure (Any) (defaults to: 'present')

    Is passed to the package reference. Valid values are present or a version number.

  • package_name (Any) (defaults to: 'datastax-agent')

    Is passed to the package reference.

  • service_ensure (Any) (defaults to: 'running')

    Is passed to the service reference.

  • service_enable (Any) (defaults to: true)

    Is passed to the service reference.

  • service_name (Any) (defaults to: 'datastax-agent')

    Is passed to the service reference.

  • service_provider (Any) (defaults to: undef)

    The name of the provider that runs the service. If left as undef then the OS family specific default will be used, otherwise the specified value will be used instead.

  • settings (Any) (defaults to: {})

    A hash that is passed to

    create_ini_settings

    (github.com/puppetlabs/puppetlabs-inifile#function-create_ini_settings) with the following additional defaults:

    “‘puppet

    path              => $address_config_file,
    key_val_separator => ': ',
    require           => Package[$package_name],
    notify            => Service['datastax-agent'],
    

    “‘



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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# File 'manifests/datastax_agent.pp', line 48

class cassandra::datastax_agent (
  $address_config_file  = '/var/lib/datastax-agent/conf/address.yaml',
  $defaults_file        = '/etc/default/datastax-agent',
  $java_home            = undef,
  $package_ensure       = 'present',
  $package_name         = 'datastax-agent',
  $service_ensure       = 'running',
  $service_enable       = true,
  $service_name         = 'datastax-agent',
  $service_provider     = undef,
  $settings             = {},
) inherits cassandra::params {
  require 'cassandra'

  if $service_provider != undef {
    System {
      provider => $service_provider,
    }
  }

  package { $package_name:
    ensure  => $package_ensure,
    require => Class['cassandra'],
    notify  => Exec['datastax_agent_reload_systemctl'],
  }

  exec { 'datastax_agent_reload_systemctl':
    command     => "${cassandra::params::systemctl} daemon-reload",
    onlyif      => "test -x ${cassandra::params::systemctl}",
    path        => ['/usr/bin', '/bin'],
    refreshonly => true,
    notify      => Service['datastax-agent'],
  }

  file { $address_config_file:
    owner   => 'cassandra',
    group   => 'cassandra',
    mode    => '0644',
    require => Package[$package_name],
  }

  if $java_home != undef {
    ini_setting { 'java_home':
      ensure            => present,
      path              => $defaults_file,
      section           => '',
      key_val_separator => '=',
      setting           => 'JAVA_HOME',
      value             => $java_home,
      notify            => Service['datastax-agent'],
    }
  }

  service { 'datastax-agent':
    ensure => $service_ensure,
    enable => $service_enable,
    name   => $service_name,
  }

  if $settings {
    $defaults = {
      path              => $address_config_file,
      key_val_separator => ': ',
      require           => Package[$package_name],
      notify            => Service['datastax-agent'],
    }

    $full_settings = {
      '' => $settings,
    }
    create_ini_settings($full_settings, $defaults)
  }
}