Is this what you are looking for?
tasks:
- name: enabling consul
service: name=consul enabled=yes state=started
when:
- service: name=consul state=stopped
*register: results ### stores output on a variable*
ignore_errors: yes
- name: show results of disabling consul
* debug: msg={{ results }} ### shows that output when ansible is played*
- name: logging the results
* shell: echo {{ results }} >> /var/log/fixing ### saves that output in
a log*
On Thursday, December 27, 2018 at 9:57:41 AM UTC-2, Jimmy Htor wrote:
>
> Hey,
>
> The way I see it you either output to STDOUT, which would make debug
> output part of the inventory data, thus corrupt it. Or you output to STDERR
> and Ansible will treat is as actual errors (and show it using red color).
>
> Is there another way to cleanly provide debug info during an Ansible run
> besides writing to a file?
>
> Thx
>
--
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/8f2e3dbf-77b1-4063-b511-1b7a982e0c35%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.