2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
language: ruby
sudo: false
cache: bundler
bundler_args: --without system_tests
bundler_args: --without system_tests --without release
script: ["bundle exec rake validate", "bundle exec rake lint", "bundle exec rake spec SPEC_OPTS='--format documentation'"]
matrix:
fast_finish: true
Expand Down
36 changes: 34 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,37 @@
# Changelog



## [2.0.0](https://github.com/camptocamp/puppet-systemd/tree/2.0.0) (2018-07-06)

[Full Changelog](https://github.com/camptocamp/puppet-systemd/compare/1.1.1...2.0.0)

**Breaking changes:**

- move params to data-in-modules [\#67](https://github.com/camptocamp/puppet-systemd/pull/67) ([bastelfreak](https://github.com/bastelfreak))

**Implemented enhancements:**

- add ubuntu 18.04 support [\#72](https://github.com/camptocamp/puppet-systemd/pull/72) ([bastelfreak](https://github.com/bastelfreak))
- bump facter to latest 2.x version [\#71](https://github.com/camptocamp/puppet-systemd/pull/71) ([bastelfreak](https://github.com/bastelfreak))
- Add enable and active parameters to unit\_file [\#69](https://github.com/camptocamp/puppet-systemd/pull/69) ([jcharaoui](https://github.com/jcharaoui))
- Add support for Resource Accounting via systemd [\#65](https://github.com/camptocamp/puppet-systemd/pull/65) ([bastelfreak](https://github.com/bastelfreak))
- Allow resolved class to configure DNS settings [\#59](https://github.com/camptocamp/puppet-systemd/pull/59) ([hfm](https://github.com/hfm))
- Replace iterator with stdlib function [\#58](https://github.com/camptocamp/puppet-systemd/pull/58) ([jfleury-at-ovh](https://github.com/jfleury-at-ovh))

**Closed issues:**

- Better test for systemd \(and other init systems\) [\#37](https://github.com/camptocamp/puppet-systemd/issues/37)

**Merged pull requests:**

- fix puppet-linter warnings in README.md [\#75](https://github.com/camptocamp/puppet-systemd/pull/75) ([bastelfreak](https://github.com/bastelfreak))
- Update the documentation of facts [\#68](https://github.com/camptocamp/puppet-systemd/pull/68) ([ekohl](https://github.com/ekohl))
- purge legacy puppet-lint checks [\#66](https://github.com/camptocamp/puppet-systemd/pull/66) ([bastelfreak](https://github.com/bastelfreak))
- Reuse the systemd::dropin\_file in service\_limits [\#61](https://github.com/camptocamp/puppet-systemd/pull/61) ([ekohl](https://github.com/ekohl))
- cleanup README.md [\#60](https://github.com/camptocamp/puppet-systemd/pull/60) ([bastelfreak](https://github.com/bastelfreak))
- implement github changelog generator [\#45](https://github.com/camptocamp/puppet-systemd/pull/45) ([bastelfreak](https://github.com/bastelfreak))

## [1.1.1](https://github.com/camptocamp/puppet-systemd/tree/1.1.1) (2017-11-29)

[Full Changelog](https://github.com/camptocamp/puppet-systemd/compare/1.1.0...1.1.1)
Expand All @@ -21,7 +52,6 @@
- Correct parameter documentation [\#53](https://github.com/camptocamp/puppet-systemd/pull/53) ([ekohl](https://github.com/ekohl))
- Use a space-separated in timesyncd.conf [\#50](https://github.com/camptocamp/puppet-systemd/pull/50) ([hfm](https://github.com/hfm))
- Use the same systemd drop-in file for different units [\#46](https://github.com/camptocamp/puppet-systemd/pull/46) ([countsudoku](https://github.com/countsudoku))
- release 1.1.0 [\#44](https://github.com/camptocamp/puppet-systemd/pull/44) ([bastelfreak](https://github.com/bastelfreak))

## [1.1.0](https://github.com/camptocamp/puppet-systemd/tree/1.1.0) (2017-10-24)

Expand Down Expand Up @@ -148,5 +178,7 @@
- Confine rspec pinning to ruby 1.8



\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*


\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
7 changes: 5 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ group :development, :unit_tests do
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
Expand All @@ -23,6 +22,10 @@ group :development, :unit_tests do
gem 'json_pure', '< 2.0.2', :require => false
end

group :release do
gem 'github_changelog_generator', :require => false, :git => 'https://github.com/skywinder/github-changelog-generator.git'
end

group :system_tests do
gem 'beaker', :require => false
gem 'beaker-rspec', '> 5', :require => false
Expand All @@ -35,7 +38,7 @@ 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
gem 'facter', '~> 2.5.0', :require => false
end

if puppetversion = ENV['PUPPET_GEM_VERSION']
Expand Down
80 changes: 58 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

This module declares exec resources to create global sync points for reloading systemd.

**Version 2 and newer of the module don't work with Hiera 3! You need to migrate your existing Hiera setup to Hiera 5**

## Usage and examples

There are two ways to use this module.
Expand All @@ -16,51 +18,64 @@ There are two ways to use this module.
Let this module handle file creation and systemd reloading.

```puppet
::systemd::unit_file { 'foo.service':
systemd::unit_file { 'foo.service':
source => "puppet:///modules/${module_name}/foo.service",
} ~> service {'foo':
}
~> service {'foo':
ensure => 'running',
}
```

Or handle file creation yourself and trigger systemd.

```puppet
include ::systemd::systemctl::daemon_reload
include systemd::systemctl::daemon_reload
file { '/usr/lib/systemd/system/foo.service':
ensure => file,
owner => 'root',
group => 'root',
mode => '0644',
source => "puppet:///modules/${module_name}/foo.service",
} ~> Class['systemd::systemctl::daemon_reload']
}
~> Class['systemd::systemctl::daemon_reload']
service {'foo':
ensure => 'running',
subscribe => File['/usr/lib/systemd/system/foo.service'],
}
```

You can also use this module to more fully manage the new unit. This example deploys the unit, reloads systemd and then enables and starts it.

```puppet
systemd::unit_file { 'foo.service':
source => "puppet:///modules/${module_name}/foo.service",
enable => true,
active => true,
}
```

### drop-in files

Drop-in files are used to add or alter settings of a unit without modifying the
unit itself. As for the unit files, the module can handle the file and
directory creation and systemd reloading:

```puppet
::systemd::dropin_file { 'foo.conf':
systemd::dropin_file { 'foo.conf':
unit => 'foo.service',
source => "puppet:///modules/${module_name}/foo.conf",
} ~> service {'foo':
}
~> service {'foo':
ensure => 'running',
}
```

Or handle file and directory creation yourself and trigger systemd:

```puppet
include ::systemd::systemctl::daemon_reload
include systemd::systemctl::daemon_reload
file { '/etc/systemd/system/foo.service.d':
ensure => directory,
Expand All @@ -74,7 +89,8 @@ file { '/etc/systemd/system/foo.service.d/foo.conf':
group => 'root',
mode => '0644',
source => "puppet:///modules/${module_name}/foo.conf",
} ~> Class['systemd::systemctl::daemon_reload']
}
~> Class['systemd::systemctl::daemon_reload']
service {'foo':
ensure => 'running',
Expand All @@ -87,15 +103,15 @@ service {'foo':
Let this module handle file creation and systemd reloading

```puppet
::systemd::tmpfile { 'foo.conf':
systemd::tmpfile { 'foo.conf':
source => "puppet:///modules/${module_name}/foo.conf",
}
```

Or handle file creation yourself and trigger systemd.

```puppet
include ::systemd::tmpfiles
include systemd::tmpfiles
file { '/etc/tmpfiles.d/foo.conf':
ensure => file,
Expand All @@ -112,7 +128,7 @@ file { '/etc/tmpfiles.d/foo.conf':
Manage soft and hard limits on various resources for executed processes.

```puppet
::systemd::service_limits { 'foo.service':
systemd::service_limits { 'foo.service':
limits => {
'LimitNOFILE' => 8192,
'LimitNPROC' => 16384,
Expand All @@ -123,7 +139,7 @@ Manage soft and hard limits on various resources for executed processes.
Or provide the configuration file yourself. Systemd reloading and restarting of the service are handled by the module.

```puppet
::systemd::service_limits { 'foo.service':
systemd::service_limits { 'foo.service':
source => "puppet:///modules/${module_name}/foo.conf",
}
```
Expand All @@ -136,7 +152,7 @@ needs to be restarted to apply the configs. The defined resource can do this
for you:

```puppet
::systemd::network{'eth0.network':
systemd::network{'eth0.network':
source => "puppet:///modules/${module_name}/eth0.network",
restart_service => true,
}
Expand All @@ -148,24 +164,44 @@ Systemd provides multiple services. Currently you can manage `systemd-resolved`,
`systemd-timesyncd` and `systemd-networkd` via the main class:

```puppet
class{'::systemd':
$manage_resolved => true,
$manage_networkd => true,
$manage_timesyncd => true,
class{'systemd':
manage_resolved => true,
manage_networkd => true,
manage_timesyncd => true,
}
```

$manage_networkd is required if you want to reload it for new
`::systemd::network` resources. Setting $manage_resolved will also manage your
`systemd::network` resources. Setting $manage_resolved will also manage your
`/etc/resolv.conf`.

It is possible to configure the default ntp servers in /etc/systemd/timesyncd.conf:

```puppet
class{'::systemd':
$manage_timesyncd => true,
$ntp_server => ['0.pool.ntp.org', '1.pool.ntp.org'],
$fallback_ntp_server => ['2.pool.ntp.org', '3.pool.ntp.org'],
class{'systemd':
manage_timesyncd => true,
ntp_server => ['0.pool.ntp.org', '1.pool.ntp.org'],
fallback_ntp_server => ['2.pool.ntp.org', '3.pool.ntp.org'],
}
```

This requires puppetlabs-inifile, which is only a soft dependency in this module (you need to explicitly install it). Both parameters accept a string or an array.

### Resource Accounting

Systemd has support for different accounting option. It can track
CPU/Memory/Network stats per process. This is explained in depth at [systemd-system.conf](https://www.freedesktop.org/software/systemd/man/systemd-system.conf.html).
This defaults to off (default on most operating systems). You can enable this
with the `$manage_accounting` parameter. The module provides a default set of
working accounting options per operating system, but you can still modify them
with `$accounting`:

```puppet
class{'systemd':
manage_accounting => true,
accounting => {
'DefaultCPUAccounting' => 'yes',
'DefaultMemoryAccounting' => 'no',
}
}
```
13 changes: 13 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,16 @@ unless RUBY_VERSION =~ /^1\./
require 'puppet_blacksmith'
require 'puppet_blacksmith/rake_tasks'
end

begin
require 'github_changelog_generator/task'
GitHubChangelogGenerator::RakeTask.new :changelog do |config|
version = (Blacksmith::Modulefile.new).version
config.future_release = "#{version}" if version =~ /^\d+\.\d+.\d+$/
config.header = "# Changelog\n\n"
config.exclude_labels = %w{duplicate question invalid wontfix wont-fix modulesync skip-changelog}
config.user = 'camptocamp'
config.project = 'puppet-systemd'
end
rescue LoadError
end
8 changes: 8 additions & 0 deletions data/Archlinux.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
systemd::accounting:
DefaultCPUAccounting: 'yes'
DefaultIOAccounting: 'yes'
DefaultIPAccounting: 'yes'
DefaultBlockIOAccounting: 'yes'
DefaultMemoryAccounting: 'yes'
DefaultTasksAccounting: 'yes'
6 changes: 6 additions & 0 deletions data/CentOS-7.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
systemd::accounting:
DefaultCPUAccounting: 'yes'
DefaultBlockIOAccounting: 'yes'
DefaultMemoryAccounting: 'yes'
DefaultTasksAccounting: 'yes'
8 changes: 8 additions & 0 deletions data/Debian-10.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
systemd::accounting:
DefaultCPUAccounting: 'yes'
DefaultIOAccounting: 'yes'
DefaultIPAccounting: 'yes'
DefaultBlockIOAccounting: 'yes'
DefaultMemoryAccounting: 'yes'
DefaultTasksAccounting: 'yes'
5 changes: 5 additions & 0 deletions data/Debian-8.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
systemd::accounting:
DefaultCPUAccounting: 'yes'
DefaultBlockIOAccounting: 'yes'
DefaultMemoryAccounting: 'yes'
5 changes: 5 additions & 0 deletions data/Debian-9.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
systemd::accounting:
DefaultCPUAccounting: 'yes'
DefaultBlockIOAccounting: 'yes'
DefaultMemoryAccounting: 'yes'
6 changes: 6 additions & 0 deletions data/RedHat-7.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
systemd::accounting:
DefaultCPUAccounting: 'yes'
DefaultBlockIOAccounting: 'yes'
DefaultMemoryAccounting: 'yes'
DefaultTasksAccounting: 'yes'
6 changes: 6 additions & 0 deletions data/Ubuntu-16.04.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
systemd::accounting:
DefaultCPUAccounting: 'yes'
DefaultBlockIOAccounting: 'yes'
DefaultMemoryAccounting: 'yes'
DefaultTasksAccounting: 'yes'
8 changes: 8 additions & 0 deletions data/Ubuntu-18.04.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
systemd::accounting:
DefaultCPUAccounting: 'yes'
DefaultIOAccounting: 'yes'
DefaultIPAccounting: 'yes'
DefaultBlockIOAccounting: 'yes'
DefaultMemoryAccounting: 'yes'
DefaultTasksAccounting: 'yes'
20 changes: 20 additions & 0 deletions data/common.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
systemd::service_limits: {}
systemd::manage_resolved: false
systemd::resolved_ensure: 'running'
systemd::dns: ~
systemd::fallback_dns: ~
systemd::domains: ~
systemd::llmnr: ~
systemd::multicast_dns: ~
systemd::dnssec: ~
systemd::cache: false
systemd::dns_stub_listener: ~
systemd::manage_networkd: false
systemd::networkd_ensure: 'running'
systemd::manage_timesyncd: false
systemd::timesyncd_ensure: 'running'
systemd::ntp_server: ~
systemd::fallback_ntp_server: ~
systemd::manage_accounting: false
systemd::accounting: {}
12 changes: 12 additions & 0 deletions hiera.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
version: 5
defaults:
datadir: 'data'
data_hash: 'yaml_data'
hierarchy:
- name: 'Major Version'
path: '%{facts.os.name}-%{facts.os.release.major}.yaml'
- name: 'Distribution Name'
path: '%{facts.os.name}.yaml'
- name: 'common'
path: 'common.yaml'
Loading