Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

arubainstant_config beautify output from commands etc. #90

Open
mac0815 opened this issue Apr 21, 2020 · 2 comments
Open

arubainstant_config beautify output from commands etc. #90

mac0815 opened this issue Apr 21, 2020 · 2 comments

Comments

@mac0815
Copy link

mac0815 commented Apr 21, 2020

Hi
is there already a possibility to beautify the output from the playbooks ?
at the moment you have to use -v switch to get any output and that output is hard to read.
like this:
https://docs.ansible.com/ansible/2.9/reference_appendices/interpreter_discovery.html for more information.
changed: [192.168.100.31] => {"ansible_facts": {"discovered_interpreter_python": "/usr/bin/python"}, "changed": true, "msg": "{u'Status': u'Success', u'CLI Command executed': u'show network\n', u'IAP IP address': u'192.168.100.31', u'Command output': u'cli output: \n\nCOMMAND=show network\n\r\nNetworks\n--------\nProfile Name ESSID Clients Type Band Authentication Method Key Management IP Assignment Status Zone Coding Active Max IPv4 Users\n------------ ----- ------- ---- ---- --------------------- -------------- ------------- ------ ---- ------ ------ --------------\nSetMeUp SetMeUp-C0:AE:C3 0 employee 2.4 None none NAT Mode Enabled - Default Yes N/A', u'Status-code': 0}", "status_code": 200}

PLAY RECAP *******************************************************************************************************************************************************************************************************************************************************************
192.168.100.31 : ok=1 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0

can i somehow "debug: var=output.stdout_lines" the output ?
Regards Markus

@nikunj1210
Copy link
Contributor

You can use: | sed 's/\n/\n/g' with ansible-playbook command to receive better structured output in the above example.

Eg: ansible-plabook filename.yml -v | sed 's/\n/\n/g'

@JCTechSol
Copy link

JCTechSol commented Mar 17, 2021

I agree with @mac0815, the output is less then desirable...

While @nikunj1210's suggestion works, I don't like that it drops all the ansible color\formatting.

I found that registering the task output and writing it to a file with {{ foobar.response | string }} work well. It looks like you would expect. I was even able to get a easy to read diff of the changes using this method

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants