-
-
Notifications
You must be signed in to change notification settings - Fork 144
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add support for journal upload and remote server #482
Merged
+311
−0
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
d714995
add support for journal upload to a remote server
trefzer 2c9f55d
prefix ini_setting resources
trefzer f7a6215
add journal-remote settings
trefzer b5d0455
update dokumentation and service settings
trefzer 895a42e
enable systemd-journal-remote service
trefzer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
--- | ||
systemd::nspawn_package: 'systemd-container' | ||
systemd::journal_upload::package_name: 'systemd-journal-remote' | ||
systemd::journal_remote::package_name: 'systemd-journal-remote' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# @api private | ||
# @summary This class manages and configures journal-remote. | ||
# @see https://www.freedesktop.org/software/systemd/man/journal-remote.conf.html | ||
# | ||
# @param package_name | ||
# name of the package to install for the functionality | ||
# | ||
class systemd::journal_remote ( | ||
Optional[String[1]] $package_name = undef, | ||
) { | ||
assert_private() | ||
|
||
if $package_name { | ||
stdlib::ensure_packages($package_name) | ||
} | ||
|
||
service { 'systemd-journal-remote': | ||
ensure => running, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should we also set There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
enable => true, | ||
} | ||
$systemd::journal_remote_settings.each |$option, $value| { | ||
ini_setting { "journal-remote_${option}": | ||
path => '/etc/systemd/journal-remote.conf', | ||
section => 'Remote', | ||
setting => $option, | ||
notify => Service['systemd-journal-remote'], | ||
} | ||
if $value =~ Systemd::JournaldSettings::Ensure { | ||
Ini_setting["journal-remote_${option}"] { | ||
* => $value, | ||
} | ||
} else { | ||
Ini_setting["journal-remote_${option}"] { | ||
value => $value, | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# @api private | ||
# @summary This class manages and configures journal-upload. | ||
# @see https://www.freedesktop.org/software/systemd/man/journald.conf.html | ||
# | ||
# @param package_name | ||
# name of the package to install for the functionality | ||
# | ||
# @param service_ensure | ||
# what we ensure for the service | ||
# | ||
# @param service_enable | ||
# to enable the service | ||
# | ||
class systemd::journal_upload ( | ||
Optional[String[1]] $package_name = undef, | ||
Enum['running','stopped'] $service_ensure = 'running', | ||
Boolean $service_enable = true, | ||
) { | ||
assert_private() | ||
|
||
if $package_name { | ||
stdlib::ensure_packages($package_name) | ||
} | ||
|
||
service { 'systemd-journal-upload': | ||
ensure => $service_ensure, | ||
enable => $service_enable, | ||
} | ||
$systemd::journal_upload_settings.each |$option, $value| { | ||
ini_setting { "journal-upload_${option}": | ||
path => '/etc/systemd/journal-upload.conf', | ||
section => 'Upload', | ||
setting => $option, | ||
notify => Service['systemd-journal-upload'], | ||
} | ||
if $value =~ Systemd::JournaldSettings::Ensure { | ||
Ini_setting["journal-upload_${option}"] { | ||
* => $value, | ||
} | ||
} else { | ||
Ini_setting["journal-upload_${option}"] { | ||
value => $value, | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# @summary matches Systemd journal remote config Struct | ||
type Systemd::JournalRemoteSettings = Struct[ | ||
# lint:ignore:140chars | ||
{ | ||
Optional['Seal'] => Variant[Enum['yes','no'],Systemd::JournaldSettings::Ensure], | ||
Optional['SplitMode'] => Variant[Enum['host','none'],Systemd::JournaldSettings::Ensure], | ||
Optional['ServerKeyFile'] => Variant[Stdlib::Unixpath,Systemd::JournaldSettings::Ensure], | ||
Optional['ServerCertificateFile'] => Variant[Stdlib::Unixpath,Systemd::JournaldSettings::Ensure], | ||
Optional['TrustedCertificateFile'] => Variant[Stdlib::Unixpath,Systemd::JournaldSettings::Ensure], | ||
Optional['MaxUse'] => Variant[Systemd::Unit::Amount,Systemd::JournaldSettings::Ensure], | ||
Optional['KeepFree'] => Variant[Systemd::Unit::Amount,Systemd::JournaldSettings::Ensure], | ||
Optional['MaxFileSize'] => Variant[Systemd::Unit::Amount,Systemd::JournaldSettings::Ensure], | ||
Optional['MaxFiles'] => Variant[Integer,Systemd::JournaldSettings::Ensure], | ||
} | ||
# lint:endignore | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# @summary matches Systemd journal upload config Struct | ||
type Systemd::JournalUploadSettings = Struct[ | ||
# lint:ignore:140chars | ||
{ | ||
Optional['URL'] => Variant[Stdlib::HTTPUrl,Systemd::JournaldSettings::Ensure], | ||
Optional['ServerKeyFile'] => Variant[Stdlib::Unixpath,Systemd::JournaldSettings::Ensure], | ||
Optional['ServerCertificateFile'] => Variant[Stdlib::Unixpath,Systemd::JournaldSettings::Ensure], | ||
Optional['TrustedCertificateFile'] => Variant[Stdlib::Unixpath,Systemd::JournaldSettings::Ensure], | ||
Optional['NetworkTimeoutSec'] => Variant[Systemd::Unit::Timespan,Systemd::JournaldSettings::Ensure], | ||
} | ||
# lint:endignore | ||
] |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO if the management of the package is already configureable and the package itself is very specific to the module, we don't need to wrap it in a function call.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
right, but there is currently only one package for upload and remote journal (called systemd-journal-remote) in Debian and RedHat.
This solution gives you the possibility to einer install upload and remote or both.
So I think it's better (and future proof) to keep it like this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh it's the same package. This packaging is so stupid :(
yes in that case it makes sense to stick to
stdlib::ensure_packages()