diff --git a/hieradata/common.yaml b/hieradata/common.yaml index e110d0a..e08325e 100644 --- a/hieradata/common.yaml +++ b/hieradata/common.yaml @@ -358,6 +358,10 @@ networking::route_defaults: netmask: 0.0.0.0 network: default +# logging: +victorialogs::client::journald::enable: true +victorialogs::client::journald::inserturl: https://vlinsert.service.consul:9428/insert/journald + # FIXME these are for the proxmox ceph cluster profiles::ceph::client::fsid: 7f7f00cb-95de-498c-8dcc-14b54e4e9ca8 profiles::ceph::client::mons: diff --git a/modules/victorialogs/manifests/client/journald.pp b/modules/victorialogs/manifests/client/journald.pp new file mode 100644 index 0000000..551361e --- /dev/null +++ b/modules/victorialogs/manifests/client/journald.pp @@ -0,0 +1,41 @@ +class victorialogs::client::journald ( + Boolean $enable = false, + Stdlib::HTTPUrl $inserturl = 'http://localhost:9428/insert/journald', + Stdlib::Absolutepath $serverkeyfile = '/etc/pki/tls/vault/private.key', + Stdlib::Absolutepath $servercrtfile = '/etc/pki/tls/vault/certificate.crt', + Stdlib::Absolutepath $trustedcafile = '/etc/pki/tls/certs/ca-bundle.crt', +){ + + if $enable { + package {'systemd-journal-remote': + ensure => installed, + notify => Service['systemd-journal-upload'] + } + + file {'/etc/systemd/journal-upload.conf.d/': + ensure => directory, + owner => 'root', + group => 'root' + } + + file {'/etc/systemd/journal-upload.conf.d/victorialogs.conf': + ensure => file, + owner => 'root', + group => 'root', + mode => '0644', + content => template('victorialogs/client.journald.conf.erb') + } + + service {'systemd-journal-upload': + ensure => true, + enable => true, + subscribe => File['/etc/systemd/journal-upload.conf.d/victorialogs.conf'], + } + }else{ + + file {'/etc/systemd/journal-upload.conf.d/victorialogs.conf': + ensure => absent, + } + + } +} diff --git a/modules/victorialogs/templates/client.journald.conf.erb b/modules/victorialogs/templates/client.journald.conf.erb new file mode 100644 index 0000000..464a3b8 --- /dev/null +++ b/modules/victorialogs/templates/client.journald.conf.erb @@ -0,0 +1,9 @@ +# This file is managed by Puppet +# +# See journal-upload.conf(5) for details. + +[Upload] +URL=<%= @inserturl %> +ServerKeyFile=<%= @serverkeyfile %> +ServerCertificateFile=<%= @servercrtfile %> +TrustedCertificateFile=<%= @trustedcafile %> diff --git a/site/profiles/manifests/base.pp b/site/profiles/manifests/base.pp index 4c5c70f..7add82f 100644 --- a/site/profiles/manifests/base.pp +++ b/site/profiles/manifests/base.pp @@ -39,6 +39,7 @@ class profiles::base ( include profiles::cloudinit::init include profiles::helpers::node_lookup include profiles::consul::client + include victorialogs::client::journald # include the python class class { 'python':