我正在尝试使用to_nice_json输出检索到的Juniper json配置文件。我不能使用诸如"json.tool“这样的post剧本工具,但我宁愿提取配置并将其保存为nice_json格式。下面是我的任务,创建一个序列化的json文件。
- 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"发布于 2021-07-26 10:02:16
将过滤器"to_nice_json“添加到目的地,这应该会起到作用:
- name: Copy temp json file to timestamped file
copy:
src: "{{ temp_config_file }}"
dest: "{{ conf_file_json | to_nice_json }}.json"https://stackoverflow.com/questions/68414056
复制相似问题