how to get only and only command output in ansible playbook

217 views
Skip to first unread message

Sameer Modak

unread,
Nov 7, 2017, 11:24:10 AM11/7/17
to Ansible Project
Hello Team,

Whenever i run my playbook, it gives me below output which i do not want i just want standard output or standard error.

---
- hosts: all
  remote_user: ansible
  become: yes
  become_method: sudo
  gather_facts: no
  tasks:
  - name: dislpyname
    command: /usr/bin/subscription-manager status
    register: out
  - debug: var=out.stderr
~










Now for below i just want "Error updating system data on the server, see /var/log/rhsm/rhsm.log for more details." nothing else.

fatal: [pdc2lodbk01.baf.ikano]: FAILED! => {"changed": true, "cmd": ["/usr/bin/subscription-manager", "status"], "delta": "0:00:09.188844", "end": "2017-11-07 17:23:13.859596", "failed": true, "rc": 1, "start": "2017-11-07 17:23:04.670752", "stderr": "", "stderr_lines": [], "stdout": "+-------------------------------------------+\n   System Status Details\n+-------------------------------------------+\nOverall Status: Unknown", "stdout_lines": ["+-------------------------------------------+", "   System Status Details", "+-------------------------------------------+", "Overall Status: Unknown"]}


fatal: [uvdclasx137.baf.ikano]: FAILED! => {"changed": true, "cmd": ["/usr/bin/subscription-manager", "status"], "delta": "0:02:06.338207", "end": "2017-11-07 17:19:25.150107", "failed": true, "rc": 70, "start": "2017-11-07 17:17:18.811900", "stderr": "Error updating system data on the server, see /var/log/rhsm/rhsm.log for more details.", "stderr_lines": ["Error updating system data on the server, see /var/log/rhsm/rhsm.log for more details."], "stdout": "", "stdout_lines": []}
fatal: [uvdclasx138.baf.ikano]: FAILED! => {"changed": true, "cmd": ["/usr/bin/subscription-manager", "status"], "delta": "0:02:06.303761", "end": "2017-11-07 17:19:27.735012", "failed": true, "rc": 70, "start": "2017-11-07 17:17:21.431251", "stderr": "Error updating system data on the server, see /var/log/rhsm/rhsm.log for more details.", "stderr_lines": ["Error updating system data on the server, see /var/log/rhsm/rhsm.log for more details."], "stdout": "", "stdout_lines": []}
fatal: [uvdclasx187.baf.ikano]: FAILED! => {"changed": true, "cmd": ["/usr/bin/subscription-manager", "status"], "delta": "0:01:03.324022", "end": "2017-11-07 17:19:28.245675", "failed": true, "rc": 70, "start": "2017-11-07 17:18:24.921653", "stderr": "Error updating system data on the server, see /var/log/rhsm/rhsm.log for more details.", "stderr_lines": ["Error updating system data on the server, see /var/log/rhsm/rhsm.log for more details."], "stdout": "", "stdout_lines": []}

Reply all
Reply to author
Forward
0 new messages