Page MenuHomeVyOS Platform

vyos.vyos.vyos_config can't use templates anymore with ansible 2.19 and 2.20
Open, Requires assessmentPublicBUG

Description

With ansible 2.18 is was possible to use a jinja template as src in vyos.vyos.vyos_config (as its documented)

e.g.:

- name: Configure system base
  vyos.vyos.vyos_config:
    src: templates/base.j2
  tags: vyos_base

and base.j2

set system host-name {{ inventory_hostname }}

with 2.18 it worked as expected

whereas with >=2.19 it seems to not use the templating syntax but is trying to apply it as plaintext

TASK [vyos_firewall : Configure system base] ******************************************************************************************************************************************************************************************************************************************************************************
task path: /redacted/tasks/main.yml:2
[ERROR]: Task failed: Action failed: b'set set system host-name{ inventory_hostname }}\r\n\r\n  Configuration path: [set] is not valid\r\n  Set failed\r\n\r\n[edit]\r\r\nnicolas@fw-dev# '
Origin: /redacted/tasks/main.yml:2:3

1 ---
2 - name: Configure system base
    ^ column 3

fatal: [fw.dev]: FAILED! => {
    "changed": false,
    "invocation": {
        "module_args": {
            "backup": false,
            "backup_options": null,
            "comment": "configured by vyos_config",
            "config": null,
            "lines": null,
            "match": "line",
            "save": false,
            "src": "\nset system host-name {{ inventory_hostname }}\n"
        }
    }
}

MSG:

b'set set system host-name{ inventory_hostname }}\r\n\r\n  Configuration path: [set] is not valid\r\n  Set failed\r\n\r\n[edit]\r\r\nnicolas@fw-dev# '

Details

Version
1.4
Is it a breaking change?
Behavior change
Issue type
Bug (incorrect behavior)

Event Timeline

Hi @nicolasberens ,

Thank you for the question.
The latest supported Ansible core version for this collection is 2.18.2
2.19+ unfortunately has a lot of changes that require the code rework, most notably, the community collections we use alongside with ours are not compatible as well (e.g. ansible.netcommon).
There is an issue https://github.com/vyos/vyos.vyos/issues/417 lodged to embrace 2.19+ at some point, but right now we have to wait for the adoption of this version by wider user base.