In Ansible, what is the difference between the service and the systemd modules? The service module seems to include the systemd module so what's the point of having systemd by itself?
Asked
Active
Viewed 1.7k times
27
-
7The service module handles various init systems by default, but now, as far as I know, they are trying to split each into their own modules. Fore reference https://github.com/ansible/ansible-modules-core/issues/3897 – tux May 15 '17 at 08:02
-
3services is for a "general" context and it works with many GNU/Linux and BSD distros, but you lack some of the needed stuff for systemd, like daemon-reload for example. – papey May 18 '17 at 15:05
1 Answers
34
The module service is a generic one. According to the Ansible documentation :
Supported init systems include BSD init, OpenRC, SysV, Solaris SMF, systemd, upstart.
The module systemd is available only from Ansible 2.2 and is dedicated to systemd.
According to the developers of Ansible :
we are moving away from having everything in a monolithic 'service' module and splitting into specific modules, following the same model the 'package' module has.

Ortomala Lokni
- 56,620
- 24
- 188
- 240