Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I pretty print an object in ansible?

I want to pretty print a registered object in ansible to help with debugging. How do I do it?

like image 937
J0hnG4lt Avatar asked Apr 20 '15 10:04

J0hnG4lt


2 Answers

You also have to_nice_yaml and to_nice_json if you want to control the format itself. More details here.

like image 190
Kashyap Avatar answered Sep 23 '22 04:09

Kashyap


You need to use with_dict and var= in your debug statement:

- tasks: 
  - name: build web node
    nova_compute:
    arguments: xyz
    register: os_web_node
  - debug: var={{ item }}
    with_dict: os_web_node
like image 20
J0hnG4lt Avatar answered Sep 23 '22 04:09

J0hnG4lt