3 [![Puppet Forge](http://img.shields.io/puppetforge/v/camptocamp/systemd.svg)](https://forge.puppetlabs.com/camptocamp/systemd)
4 [![Build Status](https://travis-ci.org/camptocamp/puppet-systemd.png?branch=master)](https://travis-ci.org/camptocamp/puppet-systemd)
8 This module declares exec resources to create global sync points for reloading systemd.
10 **Version 2 and newer of the module don't work with Hiera 3! You need to migrate your existing Hiera setup to Hiera 5**
14 There are two ways to use this module.
18 Let this module handle file creation and systemd reloading.
21 systemd::unit_file { 'foo.service':
22 source => "puppet:///modules/${module_name}/foo.service",
29 Or handle file creation yourself and trigger systemd.
32 include systemd::systemctl::daemon_reload
34 file { '/usr/lib/systemd/system/foo.service':
39 source => "puppet:///modules/${module_name}/foo.service",
41 ~> Class['systemd::systemctl::daemon_reload']
45 subscribe => File['/usr/lib/systemd/system/foo.service'],
49 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.
52 systemd::unit_file { 'foo.service':
53 source => "puppet:///modules/${module_name}/foo.service",
61 Drop-in files are used to add or alter settings of a unit without modifying the
62 unit itself. As for the unit files, the module can handle the file and
63 directory creation and systemd reloading:
66 systemd::dropin_file { 'foo.conf':
67 unit => 'foo.service',
68 source => "puppet:///modules/${module_name}/foo.conf",
75 Or handle file and directory creation yourself and trigger systemd:
78 include systemd::systemctl::daemon_reload
80 file { '/etc/systemd/system/foo.service.d':
86 file { '/etc/systemd/system/foo.service.d/foo.conf':
91 source => "puppet:///modules/${module_name}/foo.conf",
93 ~> Class['systemd::systemctl::daemon_reload']
97 subscribe => File['/etc/systemd/system/foo.service.d/foo.conf'],
103 Let this module handle file creation and systemd reloading
106 systemd::tmpfile { 'foo.conf':
107 source => "puppet:///modules/${module_name}/foo.conf",
111 Or handle file creation yourself and trigger systemd.
114 include systemd::tmpfiles
116 file { '/etc/tmpfiles.d/foo.conf':
121 source => "puppet:///modules/${module_name}/foo.conf",
123 ~> Class['systemd::tmpfiles']
128 Manage soft and hard limits on various resources for executed processes.
131 systemd::service_limits { 'foo.service':
133 'LimitNOFILE' => 8192,
134 'LimitNPROC' => 16384,
139 Or provide the configuration file yourself. Systemd reloading and restarting of the service are handled by the module.
142 systemd::service_limits { 'foo.service':
143 source => "puppet:///modules/${module_name}/foo.conf",
149 systemd-networkd is able to manage your network configuration. We provide a
150 defined resource which can write the interface configurations. systemd-networkd
151 needs to be restarted to apply the configs. The defined resource can do this
155 systemd::network{'eth0.network':
156 source => "puppet:///modules/${module_name}/eth0.network",
157 restart_service => true,
163 Systemd provides multiple services. Currently you can manage `systemd-resolved`,
164 `systemd-timesyncd` and `systemd-networkd` via the main class:
168 manage_resolved => true,
169 manage_networkd => true,
170 manage_timesyncd => true,
174 $manage_networkd is required if you want to reload it for new
175 `systemd::network` resources. Setting $manage_resolved will also manage your
178 When configuring `systemd::resolved` you could set `dns_stub_resolver` to false (default) to use a *standard* `/etc/resolved.conf`, or you could set it to `true` to use the local resolver provided by `systemd-resolved`.
180 It is possible to configure the default ntp servers in /etc/systemd/timesyncd.conf:
184 manage_timesyncd => true,
185 ntp_server => ['0.pool.ntp.org', '1.pool.ntp.org'],
186 fallback_ntp_server => ['2.pool.ntp.org', '3.pool.ntp.org'],
190 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.
192 ### Resource Accounting
194 Systemd has support for different accounting option. It can track
195 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).
196 This defaults to off (default on most operating systems). You can enable this
197 with the `$manage_accounting` parameter. The module provides a default set of
198 working accounting options per operating system, but you can still modify them
203 manage_accounting => true,
205 'DefaultCPUAccounting' => 'yes',
206 'DefaultMemoryAccounting' => 'no',