setting ansible facts from json Sep 17, 2019 Its handy to be able to set facts from json. ansible filters Sample code to extract and set fact from json. In this case json is from command line executable output. 1) capture command line output - name: register product name shell: lshw -json -quiet register: lshw_json 2) using from_json - name: lshw_json set_fact: lshw_product_name: "{{ (lshw_json.stdout | from_json).children[0].product }}" Share this: facebook twitter pinterest tumblr reddit linkedin email Please enable JavaScript to view the comments powered by Disqus.