# stunnel4 service started through ansible hangs

**URL:** <https://forum.ansible.com/t/stunnel4-service-started-through-ansible-hangs/11702>\
**Category:** Ansible Project\
**Tags:** ansible-project\
**Created:** [July 19, 2012, 6:00pm UTC](https://forum.ansible.com/t/stunnel4-service-started-through-ansible-hangs/11702 "2012-07-19T18:00:10Z")\
**Posts on this page:** 5\
**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:** [July 19, 2012, 6:00pm UTC](https://forum.ansible.com/t/stunnel4-service-started-through-ansible-hangs/11702/1 "2012-07-19T18:00:10Z")

</div>

The init script is probably returning something unexpected.

Can you include output of the actual ansible command executing the service module? I don't see that below.

Also, latest ansible on development branch? What OS?

---

<div class="post-metadata">

**Author:** ![Oli\_Yu](https://avatars.discourse-cdn.com/v4/letter/o/ecae2f/32.png) [@Oli\_Yu](https://forum.ansible.com/u/Oli_Yu)\
**Post date:** [July 19, 2012, 6:18pm UTC](https://forum.ansible.com/t/stunnel4-service-started-through-ansible-hangs/11702/2 "2012-07-19T18:18:25Z")

</div>

Unfortunately, the stunnel4 init script doesn’t support the ‘status’ command, which causes the service module to fail:

$ an server -m service -a ‘name=service state=started’  
server | FAILED =\> failed to parse: {“msg”: “failed determining the current service state =\> state stays unchanged”, “failed”: true}

{“changed”: false}

I’m running ansible/devel (commit d453000193e2f…) against a Ubuntu 11.10 server.

I’ve tried running various flavors of starting the service:

an server -m shell -a ‘service stunnel4 start’

an server -m shell -a ‘/etc/init.d/stunnel4 start’

an server -a ‘service stunnel4 start’

an server -a ‘/etc/init.d/stunnel4 start’

All seem to result in the same problem.

Oli

---

<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:** [July 19, 2012, 6:36pm UTC](https://forum.ansible.com/t/stunnel4-service-started-through-ansible-hangs/11702/3 "2012-07-19T18:36:37Z")

</div>

Here's what puppet does when you pass the service module information that the service has no status command:

[https://github.com/puppetlabs/puppet/blob/master/lib/puppet/provider/service/base.rb](https://github.com/puppetlabs/puppet/blob/master/lib/puppet/provider/service/base.rb)

basically it runs ps and checks for a given pattern in the ps output.

basically we could take a status=yes|no and support similar.

It would be a good option to deal with troublesome service init scripts, which are legion.

Patches for this would definitely be accepted.

---

<div class="post-metadata">

**Author:** ![Oli\_Yu](https://avatars.discourse-cdn.com/v4/letter/o/ecae2f/32.png) [@Oli\_Yu](https://forum.ansible.com/u/Oli_Yu)\
**Post date:** [July 19, 2012, 7:25pm UTC](https://forum.ansible.com/t/stunnel4-service-started-through-ansible-hangs/11702/4 "2012-07-19T19:25:54Z")

</div>

I might give this a shot. I found the next cause of the problem, though, which is that using a pseudo-tty seems to prevent the stunnel binary from spawning children, so it’s not anything ansible handles. Not sure why at this point.

Is there any way to specify that ansible avoid using a pseudo-tty for it’s connection?

---

<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:** [July 19, 2012, 7:28pm UTC](https://forum.ansible.com/t/stunnel4-service-started-through-ansible-hangs/11702/5 "2012-07-19T19:28:20Z")

</div>

Paramiko at least, with sudo mode, has to do that.

Sounds like a problem with the init script to me?
