0Pricing
Ansible Academy · Lesson

Manage Services with systemd

Start, stop and enable services.

Manage Long-Running Services

The systemd module controls services managed by systemd, the init system on most modern Linux distros. You start, stop, and enable them with it.

Start a Service

Give the service name and set state: started. The module starts it only if it is not already running, staying idempotent.

ansible.builtin.systemd:
  name: nginx
  state: started

All lessons in this course

  1. What a Module Actually Is
  2. Install Packages with the package Module
  3. Manage Services with systemd
  4. Read the Docs with ansible-doc
← Back to Ansible Academy