systemd

Collection: builtin

Full Name: parallax.builtin.systemd

Aliases: ansible.builtin.systemd, systemd

Synopsis

Manage systemd units, including daemon reloads and masking

Parameters

NameTypeRequiredDefaultDescription
namestringName of the systemd unit
statestringstartedService state Choices: reloaded, restarted, started, stopped
enabledboolWhether the service should start on boot
daemon_reloadboolfalseRun daemon-reload before any action
daemon_reexecboolfalseRun daemon-reexec command before any action
scopestringsystemService scope Choices: system, user, global
forceboolfalseForce stop a service by sending SIGKILL
maskedboolWhether the unit should be masked
no_blockboolfalseDo not synchronously wait for operation to finish
userstringRun systemctl as this user (for user services)

Example

- name: Reload units and restart the app service
  systemd:
    name: app.service
    state: restarted
    enabled: true
    daemon_reload: true