systemd

A module for managing systemd

Jarryd Beck

jarro2783

6,199 downloads

5,611 latest version

4.6 quality score

Version information

  • 0.0.6 (latest)
  • 0.0.5
  • 0.0.4
  • 0.0.3
  • 0.0.2
  • 0.0.1
released Mar 7th 2017
This version is compatible with:
  • ArchLinux,
    RedHat
    ,
    Ubuntu

Start using this module

Documentation

jarro2783/systemd — version 0.0.6 Mar 7th 2017

Puppet Systemd Module

This is a Puppet module for managing systemd units.

Warning: This module is only Puppet 4 compatible.

This is a work in progress.

Usage

You should include systemd somewhere, and then you will have access to the $::systemd fact, and the resources systemd::service, systemd::dropin, and systemd::timer.

By including the systemd module, the Exec['systemctl-daemon-reload'] resource will be defined. It is defined to come before every service, so that defining a new service or modifying an existing one will reload the definition before starting the service.

Service

To define a service, use the systemd::service resource. It only takes one mandatory parameter, which is $exec_start. This is the command that will be executed to start the service.

To define a basic service that runs some executable, just do:

systemd::service { 'foo':
    exec_start => '/usr/bin/foo',
}

Timer

A timer starts a service after some specified time. To create a timer for service foo that runs daily do:

systemd::timer { 'foo':
    ensure      => 'enabled',
    on_calendar => 'daily',
}

or if you want to call the puppet resource something else, you can use the unit parameter:

systemd::timer { 'foo_timer':
    ensure      => 'enabled',
    on_calendar => 'daily',
    unit        => 'foo',
}

Drop in

A systemd drop in file allows you to override some parameters of a service. Due to the complicated way that parameters need to be overridden, rather than the systemd::dropin resource taking parameters, it just takes the content of the drop in.

systemd::dropin { 'foo_start':
    content => "ExecStart=
ExecStart=/usr/local/bin/foo run",
    service => 'foo',
}