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."
]
}
}
--
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/CAO3_%2BAG%3DwsyT6M4-svzAOzNVq0EoiHHb_xpiaoJwk2Jt1q9Ukw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.