Skip to content

Commit 4741bbc

Browse files
committed
New systemd::manage_unit and systemd::manage_dropin type
Example ```puppet systemd::manage_unit{ 'myrunner.service': $unit => { 'Description' => 'My great service', }, $service => { 'Type' => 'oneshot', 'ExecStart' => '/usr/bin/doit.sh', }, $install => { WantedBy => 'multi-user.target', }, } ``` will generate and manage a new systemd unit from a template. The type `systemd::manage_dropin` is similar for drop in files.
1 parent d9d99c3 commit 4741bbc

File tree

15 files changed

+1050
-0
lines changed

15 files changed

+1050
-0
lines changed

README.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,30 @@ systemd::unit_file { 'foo.service':
5959
}
6060
```
6161

62+
### unit files from parameters
63+
64+
Create a unit file from parameters
65+
66+
```puppet
67+
systemd::manage_unit { 'myrunner.service':
68+
$unit_entry => {
69+
'Description' => 'My great service',
70+
},
71+
$service_entry => {
72+
'Type' => 'oneshot',
73+
'ExecStart' => '/usr/bin/doit.sh',
74+
},
75+
$install_entry => {
76+
'WantedBy' => 'multi-user.target',
77+
},
78+
enable => true,
79+
active => true,
80+
}
81+
```
82+
83+
The parameters `unit_entry`, `service_entry` and `install_entry` populate the
84+
`[Unit]`, `[Service]` and `[Install]` sections of the generated unit file.
85+
6286
### drop-in files
6387

6488
Drop-in files are used to add or alter settings of a unit without modifying the
@@ -105,6 +129,21 @@ systemd::dropin_files:
105129
source: puppet:///modules/${module_name}/foo.conf
106130
```
107131
132+
### drop-in files from parameters
133+
134+
```puppet
135+
systemd::manage_dropin { 'myconf.conf':
136+
ensure => present,
137+
unit => 'myservice.service',
138+
service_entry => {
139+
'Type' => 'oneshot',
140+
'ExecStart' => ['', '/usr/bin/doit.sh'],
141+
},
142+
}
143+
```
144+
145+
The filename of the drop in. The full path is determined using the path, unit and this filename.
146+
108147
### modules-load.d
109148

110149
Create a file entry for modules-loads directory and start

0 commit comments

Comments
 (0)