aruba-ansible-modules icon indicating copy to clipboard operation
aruba-ansible-modules copied to clipboard

arubainstant_config beautify output from commands etc.

Open mac0815 opened this issue 4 years ago • 2 comments

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

mac0815 avatar Apr 21 '20 09:04 mac0815

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'

nikunj1210 avatar Apr 29 '20 20:04 nikunj1210

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

JCTechSol avatar Mar 17 '21 14:03 JCTechSol