Changeset View
Changeset View
Standalone View
Standalone View
site-modules/profile/manifests/elasticsearch/index_janitor.pp
- This file was added.
# Elasticsearch index janitor | |||||
class profile::elasticsearch::index_janitor { | |||||
$elasticsearch_nodes = lookup('swh::elasticsearch::storage_nodes') | |||||
$packages = ['python3-click', 'python3-elasticsearch', 'python3-iso8601'] | |||||
package {$packages: | |||||
ensure => present, | |||||
} | |||||
$script_name = 'elasticsearch_close_index.py' | |||||
$script_path = "/usr/local/bin/${script_name}" | |||||
file {$script_path: | |||||
ensure => present, | |||||
owner => 'root', | |||||
group => 'root', | |||||
mode => '0755', | |||||
source => "puppet:///modules/profile/elasticsearch/${script_name}", | |||||
require => Package[$packages], | |||||
} | |||||
$elasticsearch_hosts = $elasticsearch_nodes.map |$host_info| { $host_info['host'] } | |||||
$flag_es_hosts = join($elasticsearch_hosts, " --host ") | |||||
profile::cron::d {'elasticsearch-close-index': | |||||
target => 'elasticsearch', | |||||
command => "chronic sh -c '${script_path} --host ${flag_es_hosts} --timeout 1200'", | |||||
olasd: should probably be wrapped in /usr/bin/chronic, unless we want a daily cronspam | |||||
user => 'root', | |||||
minute => 'fqdn_rand', | |||||
hour => 'fqdn_rand', | |||||
} | |||||
Done Inline Actionsmmm, i need to rework the hour for this cron. ardumont: mmm, i need to rework the hour for this cron.
But the rest remains reviewable. | |||||
Done Inline Actionsnope, it's fine once a day, so it's back ;) ardumont: nope, it's fine once a day, so it's back ;) | |||||
} |
should probably be wrapped in /usr/bin/chronic, unless we want a daily cronspam