I'm coming from the Docker side of things. Managing "services" is rather simple. 1 "service" = 1 container. Ensuring that a service is running at startup is easy with Ansible.
But when it comes to managing services on a Debian/Ubuntu based Linux machine, I know there's systemd
. But I can't find a proper Ansible module to define services and ensure that they run on startup. How can I achieve that?
Your question is very vague and does not provide much information. However, regarding
... I can't find a proper Ansible module to define services ...
you may have a look into the documentation of the systemd
_module.
To
... ensure that they run on startup ...
you could use something like
- name: Make sure {{ SERVICE }} is started and enabled
systemd:
name: "{{ SERVICE }}"
state: started
enabled: true
To be able to start and enable a "service" via the systemd
_module you'll need just a systemd service file.
Further Documentation
One example for creating and managing a simple service is