Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F9697403
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
13 KB
Subscribers
None
View Options
diff --git a/Gemfile b/Gemfile
index 54862a9..95c1d66 100644
--- a/Gemfile
+++ b/Gemfile
@@ -1,47 +1,46 @@
source ENV['GEM_SOURCE'] || "https://rubygems.org"
group :development, :unit_tests do
gem 'rake', :require => false
gem 'rspec', :require => false
gem 'rspec-puppet', :require => false
gem 'puppetlabs_spec_helper', :require => false
gem 'metadata-json-lint', :require => false
gem 'puppet-lint', :require => false
gem 'puppet-lint-unquoted_string-check', :require => false
gem 'puppet-lint-empty_string-check', :require => false
gem 'puppet-lint-spaceship_operator_without_tag-check', :require => false
- gem 'puppet-lint-absolute_classname-check', :require => false
gem 'puppet-lint-undef_in_function-check', :require => false
gem 'puppet-lint-leading_zero-check', :require => false
gem 'puppet-lint-trailing_comma-check', :require => false
gem 'puppet-lint-file_ensure-check', :require => false
gem 'puppet-lint-version_comparison-check', :require => false
gem 'puppet-lint-file_source_rights-check', :require => false
gem 'puppet-lint-alias-check', :require => false
gem 'rspec-puppet-facts', :require => false
gem 'puppet-blacksmith', :require => false if RUBY_VERSION !~ /^1\./
gem 'json_pure', '< 2.0.2', :require => false
end
group :system_tests do
gem 'beaker', :require => false
gem 'beaker-rspec', '> 5', :require => false
gem 'beaker_spec_helper', :require => false
gem 'serverspec', :require => false
gem 'specinfra', :require => false
end
if facterversion = ENV['FACTER_GEM_VERSION']
gem 'facter', facterversion, :require => false
else
# There are no facts in place for facter > 2.4 in rspec-puppet-facts yet
gem 'facter', '~> 2.4.0', :require => false
end
if puppetversion = ENV['PUPPET_GEM_VERSION']
gem 'puppet', puppetversion, :require => false
else
gem 'puppet', :require => false
end
# vim:ft=ruby
diff --git a/manifests/dropin_file.pp b/manifests/dropin_file.pp
index a6a910f..55a8542 100644
--- a/manifests/dropin_file.pp
+++ b/manifests/dropin_file.pp
@@ -1,68 +1,68 @@
# Creates a drop-in file for a systemd unit
#
# @api public
#
# @see systemd.unit(5)
#
# @attr name [Pattern['^.+\.conf$']]
# The target unit file to create
#
# * Must not contain ``/``
#
# @attr path
# The main systemd configuration path
#
# @attr content
# The full content of the unit file
#
# * Mutually exclusive with ``$source``
#
# @attr source
# The ``File`` resource compatible ``source``
#
# * Mutually exclusive with ``$content``
#
# @attr target
# If set, will force the file to be a symlink to the given target
#
# * Mutually exclusive with both ``$source`` and ``$content``
#
define systemd::dropin_file(
Systemd::Unit $unit,
Systemd::Dropin $filename = $name,
Enum['present', 'absent', 'file'] $ensure = 'present',
Stdlib::Absolutepath $path = '/etc/systemd/system',
Optional[String] $content = undef,
Optional[String] $source = undef,
Optional[Stdlib::Absolutepath] $target = undef,
) {
- include ::systemd
+ include systemd
if $target {
$_ensure = 'link'
} else {
$_ensure = $ensure ? {
'present' => 'file',
default => $ensure,
}
}
if $ensure != 'absent' {
ensure_resource('file', "${path}/${unit}.d", {
ensure => directory,
owner => 'root',
group => 'root',
})
}
file { "${path}/${unit}.d/${filename}":
ensure => $_ensure,
content => $content,
source => $source,
target => $target,
owner => 'root',
group => 'root',
mode => '0444',
notify => Class['systemd::systemctl::daemon_reload'],
}
}
diff --git a/manifests/init.pp b/manifests/init.pp
index 6d8077c..f90e6d1 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -1,62 +1,62 @@
# This module allows triggering systemd commands once for all modules
#
# @api public
#
# @param service_limits
# May be passed a resource hash suitable for passing directly into the
# ``create_resources()`` function as called on ``systemd::service_limits``
#
# @param manage_resolved
# Manage the systemd resolver
#
# @param resolved_ensure
# The state that the ``resolved`` service should be in
#
# @param manage_networkd
# Manage the systemd network daemon
#
# @param networkd_ensure
# The state that the ``networkd`` service should be in
#
# @param manage_timesyncd
# Manage the systemd tiemsyncd daemon
#
# @param timesyncd_ensure
# The state that the ``timesyncd`` service should be in
#
# @param ntp_server
# comma separated list of ntp servers, will be combined with interface specific
# addresses from systemd-networkd. requires puppetlabs-inifile
#
# @param fallback_ntp_server
# A space-separated list of NTP server host names or IP addresses to be used
# as the fallback NTP servers. Any per-interface NTP servers obtained from
# systemd-networkd take precedence over this setting. requires puppetlabs-inifile
class systemd (
Hash[String, Hash[String, Any]] $service_limits = {},
Boolean $manage_resolved = false,
Enum['stopped','running'] $resolved_ensure = 'running',
Boolean $manage_networkd = false,
Enum['stopped','running'] $networkd_ensure = 'running',
Boolean $manage_timesyncd = false,
Enum['stopped','running'] $timesyncd_ensure = 'running',
Optional[Variant[Array,String]] $ntp_server = undef,
Optional[Variant[Array,String]] $fallback_ntp_server = undef,
){
- contain ::systemd::systemctl::daemon_reload
+ contain systemd::systemctl::daemon_reload
create_resources('systemd::service_limits', $service_limits)
if $manage_resolved and $facts['systemd_internal_services'] and $facts['systemd_internal_services']['systemd-resolved.service'] {
- contain ::systemd::resolved
+ contain systemd::resolved
}
if $manage_networkd and $facts['systemd_internal_services'] and $facts['systemd_internal_services']['systemd-networkd.service'] {
- contain ::systemd::networkd
+ contain systemd::networkd
}
if $manage_timesyncd and $facts['systemd_internal_services'] and $facts['systemd_internal_services']['systemd-timesyncd.service'] {
- contain ::systemd::timesyncd
+ contain systemd::timesyncd
}
}
diff --git a/manifests/network.pp b/manifests/network.pp
index 0767280..5a49005 100644
--- a/manifests/network.pp
+++ b/manifests/network.pp
@@ -1,30 +1,30 @@
# -- Define: systemd::network
# Creates network config for systemd-networkd
define systemd::network (
Enum['file', 'absent'] $ensure = file,
Stdlib::Absolutepath $path = '/etc/systemd/network',
Optional[String] $content = undef,
Optional[String] $source = undef,
Optional[Stdlib::Absolutepath] $target = undef,
Boolean $restart_service = true,
){
- include ::systemd
+ include systemd
if $restart_service and $systemd::manage_networkd {
$notify = Service['systemd-networkd']
} else {
$notify = undef
}
file { "${path}/${name}":
ensure => $ensure,
content => $content,
source => $source,
target => $target,
owner => 'root',
group => 'root',
mode => '0444',
notify => $notify,
}
}
diff --git a/manifests/service_limits.pp b/manifests/service_limits.pp
index 2992c1c..68ac03d 100644
--- a/manifests/service_limits.pp
+++ b/manifests/service_limits.pp
@@ -1,75 +1,75 @@
# Adds a set of custom limits to the service
#
# @api public
#
# @see systemd.exec(5)
#
# @attr name [Pattern['^.+\.(service|socket|mount|swap)$']]
# The name of the service that you will be modifying
#
# @param $ensure
# Whether to drop a file or remove it
#
# @param path
# The path to the main systemd settings directory
#
# @param limits
# A Hash of service limits matching the settings in ``systemd.exec(5)``
#
# * Mutually exclusive with ``$source``
#
# @param source
# A ``File`` resource compatible ``source``
#
# * Mutually exclusive with ``$limits``
#
# @param restart_service
# Restart the managed service after setting the limits
#
define systemd::service_limits(
Enum['present', 'absent', 'file'] $ensure = 'present',
Stdlib::Absolutepath $path = '/etc/systemd/system',
Optional[Systemd::ServiceLimits] $limits = undef,
Optional[String] $source = undef,
Boolean $restart_service = true
) {
- include ::systemd
+ include systemd
if $name !~ Pattern['^.+\.(service|socket|mount|swap)$'] {
fail('$name must match Pattern["^.+\.(service|socket|mount|swap)$"]')
}
if $limits and !empty($limits) {
$_content = template("${module_name}/limits.erb")
}
else {
$_content = undef
}
if ($limits and !empty($limits)) and $source {
fail('You may not supply both limits and source parameters to systemd::service_limits')
}
elsif ($limits == undef or empty($limits)) and ($source == undef) {
fail('You must supply either the limits or source parameter to systemd::service_limits')
}
systemd::dropin_file { "${name}-90-limits.conf":
ensure => $ensure,
unit => $name,
filename => '90-limits.conf',
path => $path,
content => $_content,
source => $source,
}
if $restart_service {
exec { "restart ${name} because limits":
command => "systemctl restart ${name}",
path => $::path,
refreshonly => true,
subscribe => File["${path}/${name}.d/90-limits.conf"],
require => Class['systemd::systemctl::daemon_reload'],
}
}
}
diff --git a/manifests/tmpfile.pp b/manifests/tmpfile.pp
index 1e380af..c18eaae 100644
--- a/manifests/tmpfile.pp
+++ b/manifests/tmpfile.pp
@@ -1,54 +1,54 @@
# Creates a systemd tmpfile
#
# @api public
#
# @see systemd-tmpfiles(8)
#
# @attr name [String]
# The name of the tmpfile to create
#
# * May not contain ``/``
#
# @param $ensure
# Whether to drop a file or remove it
#
# @param path
# The path to the main systemd tmpfiles directory
#
# @param content
# The literal content to write to the file
#
# * Mutually exclusive with ``$source``
#
# @param source
# A ``File`` resource compatible ``source``
#
# * Mutually exclusive with ``$limits``
#
define systemd::tmpfile(
Enum['present', 'absent', 'file'] $ensure = 'file',
Stdlib::Absolutepath $path = '/etc/tmpfiles.d',
Optional[String] $content = undef,
Optional[String] $source = undef,
) {
- include ::systemd::tmpfiles
+ include systemd::tmpfiles
if $name =~ Pattern['/'] {
fail('$name may not contain a forward slash "(/)"')
}
$_tmp_file_ensure = $ensure ? {
'present' => 'file',
default => $ensure,
}
file { "${path}/${name}":
ensure => $_tmp_file_ensure,
content => $content,
source => $source,
owner => 'root',
group => 'root',
mode => '0444',
notify => Class['systemd::tmpfiles'],
}
}
diff --git a/manifests/unit_file.pp b/manifests/unit_file.pp
index 4124bba..d20f048 100644
--- a/manifests/unit_file.pp
+++ b/manifests/unit_file.pp
@@ -1,60 +1,60 @@
# Creates a systemd unit file
#
# @api public
#
# @see systemd.unit(5)
#
# @attr name [Pattern['^.+\.(service|socket|device|mount|automount|swap|target|path|timer|slice|scope)$']]
# The target unit file to create
#
# * Must not contain ``/``
#
# @attr path
# The main systemd configuration path
#
# @attr content
# The full content of the unit file
#
# * Mutually exclusive with ``$source``
#
# @attr source
# The ``File`` resource compatible ``source``
#
# * Mutually exclusive with ``$content``
#
# @attr target
# If set, will force the file to be a symlink to the given target
#
# * Mutually exclusive with both ``$source`` and ``$content``
#
define systemd::unit_file(
Enum['present', 'absent', 'file'] $ensure = 'present',
Stdlib::Absolutepath $path = '/etc/systemd/system',
Optional[String] $content = undef,
Optional[String] $source = undef,
Optional[Stdlib::Absolutepath] $target = undef,
) {
- include ::systemd
+ include systemd
assert_type(Systemd::Unit, $name)
if $target {
$_ensure = 'link'
} else {
$_ensure = $ensure ? {
'present' => 'file',
default => $ensure,
}
}
file { "${path}/${name}":
ensure => $_ensure,
content => $content,
source => $source,
target => $target,
owner => 'root',
group => 'root',
mode => '0444',
notify => Class['systemd::systemctl::daemon_reload'],
}
}
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Mon, Aug 18, 11:37 PM (2 w, 16 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3333677
Attached To
R139 puppet-camptocamp-systemd
Event Timeline
Log In to Comment