Why doesn't debug get me the output of these commands

22 views
Skip to first unread message

Pro Va

unread,
Aug 12, 2019, 5:01:46 PM8/12/19
to Ansible Project
Hello All ,

I am trying to run a playbook that gets me the status of Postfix instances running on an email relay server.

my playbook looks like this :


******************************************************************************

  - name: checking status of Inbound Instance
    command: postmulti -i postfix-in-1 -p status
    register: result
    ignore_errors: yes
    changed_when: False
    become: yes

  - name: showing in-1 status
    debug:
     var: result.stdout


  - name: checking status of Outbound Instance
    shell: /usr/sbin/postmulti -i postfix-out-1 -p status
    register: result2
    become: yes
    changed_when: False
  - debug: msg="{{ result2.stdout }}"


*******************************************************************************

i am expecting an output like this , which normally gets written to screen when run on the server :

postfix-in-1/postfix-script: the Postfix mail system is running: PID: 8218
postfix-out-1/postfix-script: the Postfix mail system is running: PID: 7321

but ansible playbook has a null stdout or stdout_lines .

any suggestions appreciated : ) .

Dick Visser

unread,
Aug 13, 2019, 1:31:43 AM8/13/19
to ansible...@googlegroups.com


Which command did you run, and what output did you get from that (copied as text, not as images/attachments/screenshots)?



--
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 ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/81645deb-3708-4025-b226-d4296f4ad63f%40googlegroups.com.
--
Sent from a mobile device - please excuse the brevity, spelling and punctuation.

Pro Va

unread,
Aug 13, 2019, 3:48:06 AM8/13/19
to Ansible Project
Thanks for your response , if i run this command on email relay server running postfix 

" postmulti -i postfix-in-1 -p status " >> it gives me the following output >> " postfix-in-1/postfix-script: the Postfix mail system is running: PID: 8218 "

this tells me the instance is running , now i wanted my playbook to run the same command on the server and capture the output .

I basically wanted to run this playbook on a group of mail servers to check if postfix instance is running .

Ty.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible...@googlegroups.com.

Pro Va

unread,
Aug 13, 2019, 3:52:44 AM8/13/19
to Ansible Project
My ansible playbook output is like this :

ok: [192.x.x.x] => {
    "msg": ""
}
ok: [192.x.x.x] => {
    "msg": ""
}
ok: [192.x.x.x] => {
    "msg": ""
}
ok: [192.x.x.x] => {
    "msg": ""
}

so it tells me the command is executed but doesn't capture the output of the command as stdout.

Stefan Hornburg (Racke)

unread,
Aug 13, 2019, 4:21:03 AM8/13/19
to ansible...@googlegroups.com
On 8/13/19 9:48 AM, Pro Va wrote:
> Thanks for your response , if i run this command on email relay server running postfix 
>
> " postmulti -i postfix-in-1 -p status " >> it gives me the following output >> " postfix-in-1/postfix-script: the
> Postfix mail system is running: PID: 8218 "
>
> this tells me the instance is running , now i wanted my playbook to run the same command on the server and capture the
> output .
>
> I basically wanted to run this playbook on a group of mail servers to check if postfix instance is running .
>
> Ty.

For some reason postmulti's output is sent to stderr instead of stdout.

Regards
Racke
> <javascript:>.
> <https://groups.google.com/d/msgid/ansible-project/81645deb-3708-4025-b226-d4296f4ad63f%40googlegroups.com?utm_medium=email&utm_source=footer>.
>
> --
> Sent from a mobile device - please excuse the brevity, spelling and punctuation.
>
> --
> 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
> ansible-proje...@googlegroups.com <mailto:ansible-proje...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/e2c8e960-4b16-4d02-8c9b-01c7370207da%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/e2c8e960-4b16-4d02-8c9b-01c7370207da%40googlegroups.com?utm_medium=email&utm_source=footer>.


--
Ecommerce and Linux consulting + Perl and web application programming.
Debian and Sympa administration. Provisioning with Ansible.

signature.asc

Pramod Thombare

unread,
Aug 13, 2019, 1:31:14 PM8/13/19
to ansible...@googlegroups.com
Remove changed_when and run playbook ... 

--
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 ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/81645deb-3708-4025-b226-d4296f4ad63f%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages