Vincent Van der Kussen
unread,Mar 20, 2014, 8:48:09 AM3/20/14Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ansible...@googlegroups.com
Hi,
I've a playbook where I register the state of a service. I have a
task in the same playbook that is executed based on the output of the
registered state.
Everything works but when the service is stopped the task that
registers the state returns failed.
Functionally it works. when the service is stopped the task that
should stop the service is skipped. When the service is running, the
service is stopped. I only have a problem that the output of the task
where i register the output returns FAILED when the service is
stopped.
I'm not sure if i'm doing something wrong.
To make it a bit more clear :
Tasks in the playbook
--------------------------------
- name: get lgserver status
action: command /opt/lettergen/lgserver status
register: lgstatus
ignore_errors: True
- name: stop lgserver
action: command /opt/lettergen/lgserver stop
when: lgstatus.stdout.find('running') != -1
Output when service is stopped
----------------------------------------------
TASK: [lg-update | get lgserver status] ***************************************
failed: [192.168.192.11] => {"changed": true, "cmd":
["/opt/lettergen/lgserver", "status"], "delta": "0:00:00.158255",
"end": "2014-03-20 13:39:05.970555", "item": "", "rc": 3, "start":
"2014-03-20 13:39:05.812300"}
stdout: The daemon is stopped.
...ignoring
TASK: [lg-update | stop lgserver] *********************************************
skipping: [192.168.192.11]
Output when the service is started
--------------------------------------------------
TASK: [lg-update | stop lgserver] *********************************************
changed: [192.168.192.11]
Debug output of the registered value
----------------------------------------------------
TASK: [lg-update | debug] *****************************************************
ok: [192.168.192.11] => {
"item": "",
"lgstatus": {
"changed": true,
"cmd": [
"/opt/lettergen/lgserver",
"status"
],
"delta": "0:00:00.158255",
"end": "2014-03-20 13:39:05.970555",
"invocation": {
"module_args": "/opt/lettergen/lgserver status",
"module_name": "command"
},
"item": "",
"rc": 3,
"start": "2014-03-20 13:39:05.812300",
"stderr": "",
"stdout": "The daemon is stopped.",
"stdout_lines": [
"The daemon is stopped."
]
}
}