Changeset View
Changeset View
Standalone View
Standalone View
site-modules/profile/manifests/cassandra.pp
Show All 29 Lines | class profile::cassandra { | ||||
$cassandra_nodes = lookup('cassandra::nodes') | $cassandra_nodes = lookup('cassandra::nodes') | ||||
$node_definition = $cassandra_nodes["$::fqdn"] | $node_definition = $cassandra_nodes["$::fqdn"] | ||||
$instances = $node_definition['instances'] | $instances = $node_definition['instances'] | ||||
$default_instance_config = lookup('cassandra::default_instance_configuration') | $default_instance_config = lookup('cassandra::default_instance_configuration') | ||||
$clusters_config = lookup('cassandra::clusters') | $clusters_config = lookup('cassandra::clusters') | ||||
$jmx_remote = $default_instance_config['jmx_remote'] | |||||
$jmx_access_file = "${cassandra_config_directory}/jmxremote.access" | |||||
$jmx_password_file = "${cassandra_config_directory}/jmxremote.password" | |||||
group {$cassandra_group: | group {$cassandra_group: | ||||
system => true, | system => true, | ||||
} | } | ||||
user {$cassandra_user: | user {$cassandra_user: | ||||
system => true, | system => true, | ||||
gid => $cassandra_group, | gid => $cassandra_group, | ||||
shell => '/usr/sbin/nologin', | shell => '/usr/sbin/nologin', | ||||
▲ Show 20 Lines • Show All 69 Lines • ▼ Show 20 Lines | file {"${cassandra_config_directory}/jmx_exporter.yml": | ||||
ensure => present, | ensure => present, | ||||
owner => 'root', | owner => 'root', | ||||
group => 'root', | group => 'root', | ||||
mode => '0644', | mode => '0644', | ||||
source => "https://raw.githubusercontent.com/prometheus/jmx_exporter/parent-${jmx_exporter_version}/example_configs/cassandra.yml", | source => "https://raw.githubusercontent.com/prometheus/jmx_exporter/parent-${jmx_exporter_version}/example_configs/cassandra.yml", | ||||
require => [File[$cassandra_config_directory]], | require => [File[$cassandra_config_directory]], | ||||
} | } | ||||
if $jmx_remote == true { | |||||
$jmx_user = $default_instance_config['jmx_user'] | |||||
$jmx_password = $default_instance_config['jmx_password'] | |||||
file {$jmx_access_file: | |||||
ensure => present, | |||||
owner => 'root', | |||||
group => $cassandra_group, | |||||
mode => '0540', | |||||
content => template('profile/cassandra/jmxremote.access.erb'), | |||||
require => [File[$cassandra_config_directory]] | |||||
} | |||||
file {$jmx_password_file: | |||||
ensure => present, | |||||
owner => 'root', | |||||
group => $cassandra_group, | |||||
mode => '0540', | |||||
content => template('profile/cassandra/jmxremote.password.erb'), | |||||
require => [File[$cassandra_config_directory]] | |||||
} | |||||
} else { | |||||
file {[ $jmx_access_file, | |||||
$jmx_password_file ]: | |||||
ensure => absent, | |||||
} | |||||
} | |||||
$instances.each | $instance_name, $instance_config | { | $instances.each | $instance_name, $instance_config | { | ||||
$merged_instance_config = $default_instance_config + $instance_config | $merged_instance_config = $default_instance_config + $instance_config | ||||
$cluster_config = $clusters_config[$merged_instance_config["cluster_name"]] | $cluster_config = $clusters_config[$merged_instance_config["cluster_name"]] | ||||
$merged_config = $cluster_config + $merged_instance_config | $merged_config = $cluster_config + $merged_instance_config | ||||
profile::cassandra::instance{$instance_name: | profile::cassandra::instance{$instance_name: | ||||
config => $merged_config | config => $merged_config | ||||
} | } | ||||
} | } | ||||
} | } | ||||