Json parsing in Ansible

后端 未结 2 1668
萌比男神i
萌比男神i 2021-01-03 22:08

I have to parse the output of the following command:

mongo  --eval \"db.isMaster()\"

which gives output as follows:



        
2条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-03 22:36

    There are quite a bit of helpful filters in Ansible.

    Try: when: (output_text.stdout | from_json).ismaster

提交回复
热议问题