-
Notifications
You must be signed in to change notification settings - Fork 184
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
Manage ulimit with systemd::dropin_file and allow it to be unmanaged #391
Conversation
Test failures seem to be unrelated... |
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.
Perhaps this should also be modified to use systemd::unit_file
:
puppet-redis/manifests/instance.pp
Lines 312 to 318 in 551e58b
file { "/etc/systemd/system/${service_name}.service": | |
ensure => file, | |
owner => 'root', | |
group => 'root', | |
mode => '0644', | |
content => template('redis/service_templates/redis.service.erb'), | |
} |
https://github.com/voxpupuli/puppet-redis#soft-dependency also needs an update if systemd becomes a hard dependency.
if versioncmp($facts['puppetversion'],'6.1.0') < 0 { | ||
include systemd::systemctl::daemon_reload | ||
Augeas['Systemd redis ulimit'] ~> Class['systemd::systemctl::daemon_reload'] | ||
ensure => absent, | ||
} |
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.
There is no daemon reload code for Puppet < 6.1.0 in systemd::service_limits
. Interestingly, in combination with restart_service
that appears to be a bug.
Edit: to be clear, I don't think you should set $restart_service
to true, but it should deal with daemon reloads. Or we should drop Puppet < 6.1.0.
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.
The daemon reload is contained in systemd::dropin_file
which is invoked indirectly by systemd::service_limits
. As this PR would use the new way of defining the limits regardless of Puppet version, the reload should be handled there.
@@ -309,8 +313,8 @@ | |||
} | |||
|
|||
if $manage_service_file { | |||
file { "/etc/systemd/system/${service_name}.service": | |||
ensure => file, | |||
systemd::unit_file { "${service_name}.service": |
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.
If you pass enable and active as well, the unit file can manage the service and also properly apply daemon_reload
. This is particularly important now that camptocamp/systemd
has dropped the daemon_reload
class in master.
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.
See 58aa20c for what I think is roughly needed.
file { "/etc/systemd/system/${redis::service_name}.service.d/limit.conf": | ||
ensure => file, | ||
owner => 'root', | ||
group => 'root', | ||
mode => '0444', | ||
} | ||
augeas { 'Systemd redis ulimit' : | ||
incl => "/etc/systemd/system/${redis::service_name}.service.d/limit.conf", | ||
lens => 'Systemd.lns', | ||
changes => [ | ||
"defnode nofile Service/LimitNOFILE \"\"", | ||
"set \$nofile/value \"${redis::ulimit}\"", | ||
], | ||
} | ||
# Only necessary for Puppet < 6.1.0, | ||
# See https://github.com/puppetlabs/puppet/commit/f8d5c60ddb130c6429ff12736bfdb4ae669a9fd4 | ||
if versioncmp($facts['puppetversion'],'6.1.0') < 0 { | ||
include systemd::systemctl::daemon_reload | ||
Augeas['Systemd redis ulimit'] ~> Class['systemd::systemctl::daemon_reload'] | ||
ensure => absent, |
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.
Thinking more about this, it's a bit dubious how this should be handled. Previously it was an augeas lens which means it did manage one entry but users were free to manage other entries via other means.
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.
The idea was that there is no duplicate of old and new settings. But you are right; if users added their custom limits, they should not get removed.
We could switch the augeas lens to exclude the the NoFile line or just stop managing the file at all (which will result in duplicates of NOFile)
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.
Or we just stick to using the current approach and I'll drop switching to puppet-systemd from this PR.
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.
I don't mind doing a major version bump for it and making it clear that this is the behavior. Could use a comment perhaps?
owner => 'root', | ||
group => 'root', | ||
selinux_ignore_defaults => true, | ||
systemd::service_limits { "${redis::service_name}.service": |
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.
What do you think about moving it into instance.pp? 2c2a322
Co-authored-by: Ewoud Kohl van Wijngaarden <[email protected]>
I would be OK with that. |
I opened #396 |
This PR changes two things:
ulimit_managed
to explicitly enable/disable ulimitNote: This adds a new dependency to camptocamp/puppet-systemd.
Fixes #390
Note: I can split this PR into two/three PRs if desired (or squash the commits together).