juniper - 瞻博网络 Ansible Json 格式
问题描述
我正在尝试使用 to_nice_json 输出检索到的 Juniper json 配置文件。我不能使用诸如“json.tool”之类的后期剧本工具,但我宁愿提取配置并将其保存为 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"
解决方案
将过滤器“to_nice_json”添加到目的地,这应该可以解决问题:
- name: Copy temp json file to timestamped file
copy:
src: "{{ temp_config_file }}"
dest: "{{ conf_file_json | to_nice_json }}.json"
推荐阅读
- javascript - 如何设置 Mapbox.Geocoder 返回的自定义标记
- flutter - 参数类型“对象?” 不能在颤振中分配给参数类型“num”
- c++ - ConPTY 读取管道是否会在进程终止时收到通知?
- computer-vision - SORT算法的输入
- javascript - 如何使用 jQuery 向 html 标签添加属性
- python - 将 Python pdfrw PdfReader 对象写入字节/文件流数组
- python - TypeError:无法推断字段_jdf的类型
- svn - 请帮助修复SVN存储库
- python - 如何为 jdbc 提高 spark.write 的性能?
- git - git-commit-hash 改变了吗?(8 到 7 位数字)