Services re-enabled by Saltstack on systemd Debian Jessie

A strange behavior

If you use a Saltstack minion on a Debian 8 (Jessie), you may have encountered a strange behavior when it comes to services.
As you know (of course, no one can ignore the systemd war on Debian), systemd is now the default service manager on Debian. Well, it's much more than a service manager, but the new service management is one of the most visible changes.

The problem is that some services managed by a state are always re-enabled, even if they were already enabled.
For example, with supervisor :

The next run will yield the exact same result. Which is highly annoying if you run highstate on 20 nodes and need to read quickly the results. It's a noise.

But, why ?

For some reasons, Debian still support SysVinit scripts. There is a layer between systemd and Sysvinit scripts so systemd can (almost) manage daemons who don't have a systemd service file, old SysVinit scripts. When I say almost, I mean it : you can start, restart, reload, status, enable and disable a SysVinit scripted daemon via systemd cli tools. For example, with supervisor :

the enabled status.
Because of that, Saltstack have no way to know if a SysVinit scripted daemon is enabled or not, so it enables it at each run.

A simple solution

With Saltstack, you can specify for each service how it will be managed, with the provider parameter. The provider named debian_service will use standard SysVinit scripts to manage the service, and will fix our problem.