54 lines
1.7 KiB
Puppet
54 lines
1.7 KiB
Puppet
|
|
# Common class
|
|
class sunetdrive::common {
|
|
include sunet::tools
|
|
include sunet::motd
|
|
include apt
|
|
include apparmor
|
|
include sunet::packages::jq
|
|
if $::facts['sunet_nftables_enabled'] != 'yes' {
|
|
warning('Enabling UFW')
|
|
include ufw
|
|
} else {
|
|
if $facts['networking']['hostname'] =~ /^kube[wc]/ {
|
|
warning('Setting nftables to installed but disabled')
|
|
ensure_resource ('class','sunet::nftables::init', { enabled => false })
|
|
} else {
|
|
warning('Enabling nftables')
|
|
ensure_resource ('class','sunet::nftables::init', { })
|
|
}
|
|
}
|
|
package {'sysstat': ensure => 'latest'}
|
|
package {'needrestart': ensure => installed}
|
|
service {'sysstat': provider => 'systemd'}
|
|
file_line { 'enable_sa':
|
|
ensure => 'present',
|
|
line => 'ENABLED="true"',
|
|
path => '/etc/default/sysstat',
|
|
match => 'ENABLED="false"',
|
|
require => Package['sysstat'],
|
|
}
|
|
file_line { 'sa_cron_comment':
|
|
ensure => 'present',
|
|
line => '# Activity reports every 2 minutes everyday',
|
|
path => '/etc/cron.d/sysstat',
|
|
match => '^#\ Activity\ reports\ every\ 10\ minutes\ everyday',
|
|
require => Package['sysstat'],
|
|
notify => Service['sysstat'],
|
|
}
|
|
file_line { 'sa_cron':
|
|
ensure => 'present',
|
|
line => '*/2 * * * * root command -v debian-sa1 > /dev/null && debian-sa1 1 1',
|
|
path => '/etc/cron.d/sysstat',
|
|
match => '^5-55/10',
|
|
require => Package['sysstat'],
|
|
notify => Service['sysstat'],
|
|
}
|
|
if $::facts['os']['distro']['id'] == 'Debian' {
|
|
exec { 'sysstat_systemd_timer':
|
|
command => 'systemctl enable --now sysstat-collect.timer',
|
|
unless => 'systemctl is-enabled --quiet sysstat-collect.timer',
|
|
}
|
|
}
|
|
}
|