第二个参考中的 Ansible 变量"not found"



我在一个文件中有一个变量,我引用它就像在";vars_files";文件它看到工作一次,然后在后续引用中失败。

---
- hosts:  asa
gather_facts: no
connection: local 
vars_files:
- /var/lib/awx/projects/vpn/clientData
tasks:
- name: Build object group
asa_config:
lines:
- "object network {{ client_name }}"
- "subnet {{ app_net }} {{ app_net_mask }}" 
- name: Build tunnel interface
asa_config:
lines:
- "interface Tunnel {{ client_id }}"
- "nameif VTI-{{ client_name }}"
- "ip address {{ netaddr }} 255.255.255.252"
- "tunnel source interface outside"
- "tunnel destination {{ client_pub_ip }}"
- "tunnel mode ipsec ipv4"
- "tunnel protection ipsec profile PROFILE1" 
- name: Build tunnel groups
asa_config:
lines:
- "tunnel-group {{ client_pub_ip }} type ipsec-l2l" 
- "tunnel-group {{ client_pub_ip }} ipsec-attributes"
- "ikev2 remote-authentication pre-shared-key {{ psk_data }}"
- "ikev2 local-authentication pre-shared-key {{ psk_data }}"
- name: Build BGP
asa_config:
lines:
- "neighbor {{ netaddr }} remote-as {{ bgp_as }}"
- "neighbor {{ netadrr }} activate"
parents:
- router bgp 100
- address-family ipv4 unicast
- name: Save
asa_config:
save: yes 

变量在";构建隧道接口";但是Ansible抛出了一个";变量未找到";在";构建BGP";部分

task path: /var/lib/awx/projects/vpn/add-ecc-client-v1.yaml:35
fatal: [192.168.254.92]: FAILED! => {
"msg": "The task includes an option with an undefined variable. The error was: 'netadrr' is undefinednnThe error appears to be in '/var/lib/awx/projects/vpn/add-ecc-client-v1.yaml': line 45, column 6, but maynbe elsewhere in the file depending on the exact syntax problem.nnThe offending line appears to be:nnn   - name: Build BGPn     ^ heren"
}

vars_files内容:

client_name: kkk
client_pub_ip: 20.1.1.11
app_net: 11.11.11.0
app_net_mask: 255.255.255.0
client_id: 1111
bgp_as: 1111

psk_data: Yh8F9FJ14mS86gOWc2MdOwjXsiqNiEJVGjicPlmzRAv0UQypJhWNNckn3YggfupxUHy0qH3QHpZ
netaddr: 169.254.100.50

我错过了什么?

感谢

好的悲伤"netadrr";在第二次引用中。

很抱歉打扰

最新更新