On 01.05.16 22:49 Rick O'Shea wrote:

> As near as we can tell this is the only way to automate a playbook to 
> start, stop, restart, enable, disable or status a service is to pass a 
> variable on the command line:
> 
> ansible-playbook foo-service.yml -e state=started
> 
> Is this best practice?

I would say putting these into the handler section of your
role/playbook would be preferable, so you only restart the service if
something has changed. Unless you want to force the restart.

Remember ansible is idempotent, so starting a service that is already
started does not harm, but does not restart it either.

Johannes

-- 
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/57282A3A.9040100%40ojkastl.de.
For more options, visit https://groups.google.com/d/optout.

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to