2

I'm trying to output a retrieved Juniper json config file using to_nice_json. I can't use a post playbook tool such as "json.tool" but I'd rather pull the config and save it in nice_json format. Below is my task that creates a serialized json file.

- name: Save device "json" config
  juniper_junos_config:
    provider: "{{ netconf }}"
    retrieve: "committed"
    format: "json"
    dest: "{{ temp_config_file }}"

- name: Copy temp json file to timestamped file
  copy:
    src:  "{{ temp_config_file }}"
    dest: "{{ conf_file_json }}.json"
chester
  • 21
  • 1

1 Answers1

0

Add the filter "to_nice_json" to the destination and that should do the trick:

 - name: Copy temp json file to timestamped file
   copy:
     src:  "{{ temp_config_file }}"
     dest: "{{ conf_file_json | to_nice_json }}.json"
Jamsgrove
  • 1
  • 1