Fire in the hole: fixing up the service module on 1.1/devel... some help/testing needed

The service module was making some assumptions that the presense of a
particular service management tool meant the service could be
controlled by that particular service management tool.

The result of that was on CentOS6, I could toggle the status of
cobblerd (systemv), but I couldn't stop or start vmware-tools
(upstart)

While I have fixed this upstream, I have not yet tested this fully on
Debian/Ubuntu, or a pure systemd setup like Arch.

I am meanwhile going to proceed to testing this on Ubuntu 12.04 but
also welcome fixes in this area. Someone else can test (and revise
as needed) on Arch.

Another common problem with the service module is it always returns
"changed=True" if you specify "enabled=yes/no". This isn't really a
deal breaker, but it is unneccessary.

If someone wants to make the service enablement code check the
enablement state prior to trying to toggle the enablement, I will
definitely owe you one.

(Meanwhile, let's all curse the Linux ecosystem for having three
incompatible background service systems at once!)

--Michael

Initial tests look good for Ubuntu 12.04 for starting/stopping,
although they do a very good job of providing wrappers around all the
upstart scripts, so it can go down the "service" path for almost
everything. I'm not sure the enable/disable path is correct, so if
folks would like to explore/test this, that would be great.

This mostly leaves user testing out for the latest Fedora 18 (some
systemd) and Arch (pure systemd).

I’ll test it

With ansible 1.1 (devel) it fails.

running:
ansible archlinux -m service -a “name=ferm state=restarted” -K -u admin

error message:
failed determining service state, possible typo of service name?

I get that error too, but in my case it is caused by init script not
having a 'status' option.

I get that error too, but in my case it is caused by init script not
having a 'status' option.

The 'pattern' option works in this case.

I think we could detect that the init script did *exist* though,
though it's a little messy with systemd as you have to do a recursive
walk to find where the script may live (so it seems).

Anyway, upgrades are quite welcome.

If I get some free time I’ll do it.