Hi,
I'm not entirely sure whether this should be considered an ansible or
systemctl bug.
This email mainly targets of making others aware of this problem.
If you want to disable (enabled=no) a service on a systemd host which
is still using legacy sysv init.d scripts, ansible will fail to do so.
Systemd in general has a certain degree of backwards compatibility for
such services.
I had a short look in service.py (ansible v1.9.0.1-1).
The module executes
systemctl is-enabled <service>
in line 486 to
I you do this for a legacy service you will get:
"Failed to get unit file state for FOO.service: No such file or director
y"
(retval=1)
I guess this is why ansible believes the service is disabled already,
if it would actually run 'systemctl disable' on this service it would
achieve what one would expect: (manually invoked)
systemctl disable tor
Synchronizing state for tor.service with sysvinit using update-rc.d...
Executing /usr/sbin/update-rc.d tor defaults
Executing /usr/sbin/update-rc.d tor disable
insserv: warning: current start runlevel(s) (empty) of script `tor'
overrides LSB defaults (2 3 4 5).
insserv: warning: current stop runlevel(s) (0 1 2 3 4 5 6) of script
`tor' overrides LSB defaults (0 1 6).