kandra: Pull in known_hosts to the nagios user.

This prevents failures when new hosts are initially added to the
configuration.
This commit is contained in:
Alex Vandiver 2024-02-06 15:22:32 -05:00 committed by Alex Vandiver
parent 2cbd9c2a47
commit 96d237d57e
1 changed files with 9 additions and 3 deletions

View File

@ -2,7 +2,6 @@ class kandra::profile::nagios inherits kandra::profile::base {
include kandra::apache include kandra::apache
zulip::ssh_keys { 'nagios': }
$nagios_packages = [# Packages needed for Nagios $nagios_packages = [# Packages needed for Nagios
'nagios4', 'nagios4',
# For sending outgoing email # For sending outgoing email
@ -33,6 +32,13 @@ class kandra::profile::nagios inherits kandra::profile::base {
$hosts_smokescreen = split(zulipconf('nagios', 'hosts_smokescreen', undef), ',') $hosts_smokescreen = split(zulipconf('nagios', 'hosts_smokescreen', undef), ',')
$hosts_other = split(zulipconf('nagios', 'hosts_other', undef), ',') $hosts_other = split(zulipconf('nagios', 'hosts_other', undef), ',')
$hosts = zulipconf_nagios_hosts()
$qualified_hosts = $hosts.map |$h| { if '.' in $h { $h } else { "${h}.${default_host_domain}" }}
Kandra::User_Dotfiles['nagios'] {
keys => 'nagios',
known_hosts => $qualified_hosts,
}
file { '/etc/nagios4/': file { '/etc/nagios4/':
recurse => true, recurse => true,
purge => false, purge => false,
@ -100,7 +106,8 @@ class kandra::profile::nagios inherits kandra::profile::base {
} }
service { 'nagios4': service { 'nagios4':
ensure => running, ensure => running,
require => Kandra::User_Dotfiles['nagios'],
} }
file { [ file { [
@ -114,7 +121,6 @@ class kandra::profile::nagios inherits kandra::profile::base {
ensure => absent, ensure => absent,
} }
$hosts = zulipconf_nagios_hosts()
file { '/etc/nagios4/conf.d/zulip_autossh.cfg': file { '/etc/nagios4/conf.d/zulip_autossh.cfg':
ensure => file, ensure => file,
mode => '0644', mode => '0644',