cans.systemd-unit-install
systemd-install-unit
====================
This guide is about installing and setting up systemd units.
Unit Description
Each unit should be described using the following format:
- directory: "/some/other/path" # Where to install the unit (default: `systemd_unit_install_dir`)
remote: true # Is the unit on the local or remote machine? (default: False)
unit: "/path/to/unit.service" # Path to the unit file (must include `.service`, `.timer`, etc.)
user: true # Should the service run for a specific user (not system-wide)?
state: "started" # Should the unit start on the next boot, immediately, or never?
# Options: "disabled" (don't start), "enabled" (start next boot), "started" (start now)
tasks: # List of tasks; Used for systemd templates (default is `[]`)
- "first"
- "second"
Note: Units will be installed using Ansible's template feature.
Requirements
This role works only on systems that run systemd, which typically means Linux distributions that support it, such as Debian (and its derivatives), RedHat (and its derivatives), etc.
Role Variables
systemd_unit_install_dir
: the directory for installing units;systemd_unit_install_units
: the list of units to install as described above;systemd_unit_install_state
: the default state of the units (default: 'enabled');systemd_unit_install_remote
: whether to take unit files from the local or remote host (default: False);systemd_unit_install_user
: whether to install units system-wide (False) or per user (True), by default (default: False).
Dependencies
There are no dependencies for this role.
Example Playbook
- hosts: servers
roles:
# install a set of units from files on the remote machine
- role: cans.systemd-install-unit
systemd_unit_install_remote: True
# install a set of units from local files
- role: cans.systemd-install-unit
systemd_unit_install_units:
- unit: units/wonderful.service
directory: /usr/local/etc/systemd/system
- unit: units/critical.service
state: "started"
License
GPLv2
Author Information
Copyright © 2017-2018, Nicolas CANIART.
Installa
ansible-galaxy install cans.systemd-unit-install
Licenza
gpl-2.0
Download
152
Proprietario