I've seen this behaviour quite often when a service scripts 'status' command isn't written properly.
'service thingy status' is supposed to return true or false (and optionally print some sort of readable message), and _loads_ tend to return the wrong exit code. You can work around it by falling back to grepping ps - see the 'pattern' clause on service: . On 24 March 2014 23:20, James Goodhouse <[email protected]> wrote: > Hey Adam, > > Thanks for the reply! > > I'm running Ansible 1.5.3 and am running the task again Ubuntu 12.04. When I > say re-provision, I mean re-running the task. > > The way I'm killing the service is logging into the box and running "service > varnish stop". If I subsequently run the command "service varnish status" it > shows it as stopped. > > Thanks for the tip on using the enabled flag - I'm using it but left it off > the example i pasted in. > > - James > > > On Monday, March 24, 2014 4:17:16 PM UTC-7, Adam Morris wrote: >> >> >> >> On Monday, March 24, 2014 3:44:39 PM UTC-7, James Goodhouse wrote: >>> >>> Hey All, >>> >>> I'm having some issues getting a service to start and wanted to make sure >>> I'm not doing something stupid. >>> >> >> Ummm, That's kind of hard to say without knowing what you are doing... >> This is not an RTFM response, so please read it and see if this helps, or if >> you can at least answer the questions so that we can (possibly) help you. >> >> >>> >>> I'm installing varnish and then using the service module to start and >>> enable varnish. >>> >>> - name: start and enable service >>> service: name=varnish state=started >>> >>> All seems fine when I do a fresh provision of a box. The issue I'm seeing >>> is that if I log into the box and stop the service and re-provision, I get a >>> green light at the task and the service never gets started. >>> >> >> Which version of Ansible are you using? What OS are you running the task >> against? How are you stopping the service? What do you mean by >> re-provision? >> >> In particular I'm wondering if you are killing the varnish service so that >> it is no longer running and then the script is checking to see if the system >> thinks that varnish is running (there is still a lock file or something >> sitting around). If that is the case then Ansible doesn't know that it is >> not running, so it doesn't start it. >> >> By the way, that just starts varnish, to enable it at boot time you would >> use >> >> - name: Start and Enable Varnish >> service: name=varnish state=started enabled=yes >> >> I hope that this helps, >> >> Adam >> > -- > You received this message because you are subscribed to the Google Groups > "Ansible Project" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/2e528799-6dc3-4272-9054-4518bc7a7696%40googlegroups.com. > > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAK5eLPR_ifEh-4NB5J27maPuwigXOFOvx_Lo%2B_2uMwbq3u7i2Q%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
