add managing of services using Hiera
This commit is contained in:
@@ -44,6 +44,7 @@ base::pkg_group::java:
|
||||
|
||||
### Install Latest Package Version
|
||||
|
||||
Puppet by default only checks if a package is installed and only installs it if missing.
|
||||
To ensure that always the latest available package version is installed, append the `:latest` tag to the package name in the package group:
|
||||
|
||||
```
|
||||
@@ -96,6 +97,87 @@ Then `yum_client::package_groups` is the Hiera list to contain the package group
|
||||
|
||||
Please migrate them to the equivalent `base::*` list. You can have both of them available at the same time, with possibly the same content.
|
||||
|
||||
## Managing Services with Systemd
|
||||
|
||||
Hiera can also be used to manage services and to automate reoccuring tasks with timers.
|
||||
|
||||
### Enabling/Starting a Service
|
||||
|
||||
If the software already comes with an systemd unit file, then it is sufficient to just enable it in Hiera by using the `base::services` key:
|
||||
|
||||
```
|
||||
base::services:
|
||||
netdata:
|
||||
enable: true
|
||||
```
|
||||
The key inside is the `systemd` service name without the `.service` suffix.
|
||||
|
||||
### Disabling/Stopping a Service
|
||||
|
||||
To stop and disable an already running service, disable it in the `base::services` Hiera key with `enable: false`:
|
||||
```
|
||||
base::services:
|
||||
netdata:
|
||||
enable: false
|
||||
```
|
||||
|
||||
### Systemd Timers
|
||||
To have custom executables run regulary on given time/interval, you may use the `base::timers` Hiera key:
|
||||
|
||||
```
|
||||
base::timers:
|
||||
'timer_test':
|
||||
description: 'test timers'
|
||||
command: '/usr/bin/logger foo'
|
||||
on_calendar: '*:*:10'
|
||||
persistence: false
|
||||
```
|
||||
|
||||
For each time following keys are mandatory
|
||||
|
||||
- `description` for a short explaination what it is about
|
||||
- `command` for the command to run
|
||||
- `on_calendar`defining when it should run using the [`systemd` calendar event format](https://www.freedesktop.org/software/systemd/man/systemd.time.html#Calendar%20Events)
|
||||
|
||||
Optional is
|
||||
- `persistence` which signals if the timer should run immediately after boot when the node was switched of on the last suggested run time (default is `false`)
|
||||
|
||||
### Manage Services with Custom Unit Files
|
||||
|
||||
It is also possible to provide a full systemd unit file if there is none already. For this define the different secions and their content with subkeys below the `options` key as in below example:
|
||||
|
||||
```
|
||||
# The following service stops users from accessing the node
|
||||
# before the home directory is mounted
|
||||
base::services:
|
||||
'wait_for_home':
|
||||
enable: true
|
||||
options:
|
||||
Unit:
|
||||
Before: 'systemd-user-sessions.service'
|
||||
Install:
|
||||
WantedBy: 'multi-user.target'
|
||||
RequiredBy: 'multi-user.target'
|
||||
Service:
|
||||
Type: 'oneshot'
|
||||
ExecStart: '/opt/pli/libexec/waitformount -m /das/home'
|
||||
RemainAfterExit: 'true'
|
||||
```
|
||||
|
||||
### Enhance a Service with a Dropin Unit File
|
||||
It is possible to fine-tune already existing `systemd` unit files with dropins. These are placed as `.conf` files in `/etc/systemd/system/service_name.service.d`.
|
||||
|
||||
With the `dropin: true` parameter the content of the `options` parameter is now written into the according dropin directory:
|
||||
```
|
||||
base::services:
|
||||
'name_of_enhanced_service':
|
||||
enable: true
|
||||
dropin: true
|
||||
options:
|
||||
...
|
||||
```
|
||||
If there are multiple dropins, you might also name them individually with the `dropin_name` parameter.
|
||||
|
||||
## Management of Package Repositories
|
||||
|
||||
### Package Repository Lists
|
||||
@@ -222,7 +304,7 @@ A small list of packages managed by the Linux Team.
|
||||
- lightdm-gtk v2.0.8-3.pli, a patched lightdm-gtk-greeter ([SRPM](https://git.psi.ch/linux-infra/lightdm-gtk-rpm), [PR](https://github.com/Xubuntu/lightdm-gtk-greeter/pull/121)) which allows to limit the presented keyboard layouts
|
||||
- Code Beamer Office pluging v9.5.0 managed by Gilles Martin
|
||||
- storecli 007.2007.0000.0000 managed by Marc Caubet Serrabou
|
||||
- pam_single_kcm_cache PAM Module managed by Konrad Bucheli
|
||||
- [pam_single_kcm_cache PAM Module](https://github.com/paulscherrerinstitute/pam_single_kcm_cache) managed by Konrad Bucheli
|
||||
- [nvidia-detect](http://elrepo.org/tiki/nvidia-detect) copied over from ElRepo to make it generally available
|
||||
|
||||
### Package Repositories made Available by other PSI Groups
|
||||
|
||||
Reference in New Issue
Block a user