我有一个情况。
当我尝试在 ansible-playbook 中使用 json_query 过滤器时,返回此错误:
{"msg": "json_query 过滤器插件中的 jmespath.search 错误:\ 无效的 int() 字面量为 10:'-'"}
replace ('-','_')
我用过滤器解决了这个问题。
我有其他方法来解决这个问题吗?
完整代码在这里:
---
# tasks file for mpls-lsp
- name: Colete informações do protocolo osfp
junipernetworks.junos.junos_rpc:
rpc: get-ospf-neighbor-information
output: json
register:
_data
- name: Aplica as configurações padrão em RT-BRAS.*
ansible.builtin.debug:
var: item
loop: "{{ _data2 | json_query('ospf_neighbor_information[0].ospf_neighbor[*].neighbor_address[0].data') }}"
vars:
_data2: "{{ _data.output | replace ('-','_') }}"
when: "'device_roles_bras' in {{ group_names }}"