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

**URL:** <https://forum.ansible.com/t/fire-in-the-hole-fixing-up-the-service-module-on-1-1-devel-some-help-testing-needed/12414>\
**Category:** Ansible Project\
**Tags:** vmware, ubuntu\
**Created:** [February 24, 2013, 1:40am UTC](https://forum.ansible.com/t/fire-in-the-hole-fixing-up-the-service-module-on-1-1-devel-some-help-testing-needed/12414 "2013-02-24T01:40:25Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michael\_DeHaan](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Michael\_DeHaan](https://forum.ansible.com/u/Michael_DeHaan)\
**Post date:** [February 24, 2013, 1:40am UTC](https://forum.ansible.com/t/fire-in-the-hole-fixing-up-the-service-module-on-1-1-devel-some-help-testing-needed/12414/1 "2013-02-24T01:40:25Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Michael\_DeHaan](https://forum.ansible.com/u/Michael_DeHaan)\
**Post date:** [February 24, 2013, 3:37am UTC](https://forum.ansible.com/t/fire-in-the-hole-fixing-up-the-service-module-on-1-1-devel-some-help-testing-needed/12414/2 "2013-02-24T03:37:16Z")

</div>

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).

---

<div class="post-metadata">

**Author:** ![mujahideen.solutions](https://avatars.discourse-cdn.com/v4/letter/m/13edae/32.png) [@mujahideen.solutions](https://forum.ansible.com/u/mujahideen.solutions)\
**Post date:** [February 25, 2013, 7:12pm UTC](https://forum.ansible.com/t/fire-in-the-hole-fixing-up-the-service-module-on-1-1-devel-some-help-testing-needed/12414/3 "2013-02-25T19:12:24Z")

</div>

I’ll test it

---

<div class="post-metadata">

**Author:** ![mujahideen.solutions](https://avatars.discourse-cdn.com/v4/letter/m/13edae/32.png) [@mujahideen.solutions](https://forum.ansible.com/u/mujahideen.solutions)\
**Post date:** [February 25, 2013, 7:47pm UTC](https://forum.ansible.com/t/fire-in-the-hole-fixing-up-the-service-module-on-1-1-devel-some-help-testing-needed/12414/4 "2013-02-25T19:47:01Z")

</div>

**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?**

---

<div class="post-metadata">

**Author:** ![Brian\_Coca1](https://avatars.discourse-cdn.com/v4/letter/b/278dde/32.png) [@Brian\_Coca1](https://forum.ansible.com/u/Brian_Coca1)\
**Post date:** [February 25, 2013, 7:50pm UTC](https://forum.ansible.com/t/fire-in-the-hole-fixing-up-the-service-module-on-1-1-devel-some-help-testing-needed/12414/5 "2013-02-25T19:50:23Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Michael\_DeHaan](https://forum.ansible.com/u/Michael_DeHaan)\
**Post date:** [February 25, 2013, 7:54pm UTC](https://forum.ansible.com/t/fire-in-the-hole-fixing-up-the-service-module-on-1-1-devel-some-help-testing-needed/12414/6 "2013-02-25T19:54:44Z")

</div>

> 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.

---

<div class="post-metadata">

**Author:** ![mujahideen.solutions](https://avatars.discourse-cdn.com/v4/letter/m/13edae/32.png) [@mujahideen.solutions](https://forum.ansible.com/u/mujahideen.solutions)\
**Post date:** [February 25, 2013, 11:29pm UTC](https://forum.ansible.com/t/fire-in-the-hole-fixing-up-the-service-module-on-1-1-devel-some-help-testing-needed/12414/7 "2013-02-25T23:29:36Z")

</div>

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