You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using vyos_config, there is an error when deploying config from a template: [WARNING]: To ensure idempotency and correct diff the input configuration lines should be similar to how they appear if present in the running configuration on device including the indentation
Linux vyos-primary 5.15.71-amd64-vyos #1 SMP Wed Sep 28 17:49:43 UTC 2022 x86_64 GNU/Linux
Version: VyOS 1.4-rolling-202210020218
Release train: sagitta
Built by: [email protected]
Built on: Sun 02 Oct 2022 02:18 UTC
Build UUID: 83b7cafe-a503-40c8-adce-691c201ffac3
Build commit ID: 5852d5de3ac606
Architecture: x86_64
Boot via: installed image
System type: bare metal
Hardware vendor: Dell Inc.
Hardware model: PowerEdge R720xd
Hardware S/N: x
Hardware UUID: x
Copyright: VyOS maintainers and contributors
STEPS TO REPRODUCE
The template is as follows:
{% for interface in interfaces %}
set interfaces {{interface.type}} {{interface.name}} description "{{interface.description}}"
{% if interface.type == 'wireguard' %}
set interfaces wireguard {{interface.name}} private-key {{interface.private_key}}
{% for peer in interface.peers %}
set interfaces wireguard {{interface.name}} peer {{peer.name}} allowed-ips {{peer.allowed_ips + "/32" if "/32" not in peer.allowed_ips}}
set interfaces wireguard {{interface.name}} peer {{peer.name}} public-key {{peer.public_key}}
{% endfor %}
{% endif %}
{% endfor %}
The relevant task/config:
# Configure the host interfaces based on the host variables and group variables
- name: Configure interfaces
block:
- name: Add inherited_intefaces to interfaces
set_fact:
interfaces: "{{interfaces + [item]}}"
with_items: "{{shared_interfaces}}"
when: inherited_interfaces is defined and item.name in inherited_interfaces
- name: Configure interfaces
vyos_config:
src: configure_interfaces.j2
vyos_routers:
hosts:
vyos-primary:
ansible_host: 192.168.200.2 # Using the not VRRP IP
roles: vyos_router
interfaces:
- name: eth0
type: ethernet
enabled: true
address: "1.2.3.4/32"
description: "WAN interface"
hw-id: "aa:bb:cc:dd:ee:ff"
inherited_interfaces:
- wg0
- wg1
Should contain variables which are common between hosts
shared_interfaces:
- name: wg0
type: wireguard
address: "192.168.255.1/24"
private_key: xx
description: "VPN for office remote access {{inventory_hostname}}"
peers:
- name: b
allowed_ips: "192.168.255.3"
public_key: xx
- name: a
allowed_ips: "192.168.255.2"
public_key: xx
- name: wg1
type: wireguard
address: "192.168.254.1/24"
private_key: xx
description: "Admin VPN"
peers:
- name: b
allowed_ips: "192.168.254.3"
public_key: xx
- name: a
allowed_ips: "192.168.254.2"
public_key: xx
EXPECTED RESULTS
I expect ansible to tell me which lines were changed, and not to apply config that is already present. If i run this playbook over and over, it says changes have been made but the resulting config stays the same. It seems to work if I use the normal lines function but I'd like to use the jinja templates for nested loops and such.
It seems this could be related to the escaped quotes?
ACTUAL RESULTS
ok: [vyos-secondary] => {
"msg": {
"changed": true,
"commands": [
"set interfaces ethernet eth5 description \"test ethernet\"",
"set interfaces wireguard wg0 description \"VPN for office remote access vyos-secondary\"",
"set interfaces wireguard wg1 description \"Admin VPN\""
],
"failed": false,
"filtered": [],
"warnings": [
"To ensure idempotency and correct diff the input configuration lines should be similar to how they appear if present in the running configuration on device including the indentation"
]
}
}
[WARNING]: To ensure idempotency and correct diff the input configuration lines should be similar to how they appear if present in the running configuration on device including the indentation
The text was updated successfully, but these errors were encountered:
SUMMARY
When using vyos_config, there is an error when deploying config from a template:
[WARNING]: To ensure idempotency and correct diff the input configuration lines should be similar to how they appear if present in the running configuration on device including the indentation
ISSUE TYPE
COMPONENT NAME
vyos_config
ANSIBLE VERSION
COLLECTION VERSION
not sure how I can update this module, maybe it's using the 3.0.1 version?
CONFIGURATION
OS / ENVIRONMENT
Host: Linux boxxy 5.15.74.2-microsoft-custom-WSL2+ #20 SMP Tue Jan 10 11:55:17 CST 2023 x86_64 AMD Ryzen 9 7950X 16-Core Processor AuthenticAMD GNU/Linux
Remote host:
STEPS TO REPRODUCE
The template is as follows:
The relevant task/config:
EXPECTED RESULTS
I expect ansible to tell me which lines were changed, and not to apply config that is already present. If i run this playbook over and over, it says changes have been made but the resulting config stays the same. It seems to work if I use the normal lines function but I'd like to use the jinja templates for nested loops and such.
It seems this could be related to the escaped quotes?
ACTUAL RESULTS
[WARNING]: To ensure idempotency and correct diff the input configuration lines should be similar to how they appear if present in the running configuration on device including the indentation
The text was updated successfully, but these errors were encountered: