Something happens with ansible playbooks and 1.3.1.s1

Hi guys

we are facing issues whith my ansible playbook for Vyos backup when I upgrade to 1.3.1-S1

All works fine with 1.3.0 and 1.3.1, but fails with 1.3.1-S1.

I try to make a downgrade from 1.3.1-S1 to 1.3.1 on the same router and it works fine, so it seems something wrong with 1.3.1.S1…

This is the error message wirh 1.3.1-S1

fatal: [XPi304r-OCA-Tarragona]: FAILED! => {“ansible_facts”: {}, “changed”: false, “failed_modules”: {“vyos.vyos.vyos_facts”: {“ansible_facts”: {“discovered_interpreter_python”: “/usr/bin/python3”}, “failed”: true, “invocation”: {“module_args”: {“available_network_resources”: false, “gather_network_resources”: null, “gather_subset”: ["!config"], “provider”: null}}, “msg”: "show version\r\n\r\n Invalid command: [show]\r\n\r\nansible_adm@XPi304r-OCA-Tarragona:~$ "}}, “msg”: “The following modules failed to execute: vyos.vyos.vyos_facts\n”}

the error in verbose mode

fatal: [XPi304r-OCA-Tarragona]: FAILED! => {
“ansible_facts”: {},
“changed”: false,
“failed_modules”: {
“vyos.vyos.vyos_facts”: {
“ansible_facts”: {
“discovered_interpreter_python”: “/usr/bin/python3”
},
“exception”: " File “/tmp/ansible_vyos.vyos.vyos_facts_payload_ja8jty0b/ansible_vyos.vyos.vyos_facts_payload.zip/ansible_collections/ansible/netcommon/plugins/module_utils/network/common/network.py”, line 251, in get_capabilities\n capabilities = Connection(module._socket_path).get_capabilities()\n File “/tmp/ansible_vyos.vyos.vyos_facts_payload_ja8jty0b/ansible_vyos.vyos.vyos_facts_payload.zip/ansible/module_utils/connection.py”, line 195, in rpc\n raise ConnectionError(to_text(msg, errors=‘surrogate_then_replace’), code=code)\n",
“failed”: true,
“invocation”: {
“module_args”: {
“available_network_resources”: false,
“gather_network_resources”: null,
“gather_subset”: [
“!config”
],
“provider”: null
}
},
“msg”: "show version\r\n\r\n Invalid command: [show]\r\n\r\nansible_adm@XPi304r-OCA-Tarragona:~$ "
}
},
“msg”: “The following modules failed to execute: vyos.vyos.vyos_facts\n”

If I make a downgrade to 1.3.1, it works fine.

I have the same issue in all routers upgraded to 1.3.1-s1 (Only 3 units at this moment…two units downgraded to 1.3.1 and works, one unit remains in 1.3.1-S1 for testing)

regards

Which playbook do you use?

I don’t see such errors
Conf mode

root@ansdeb:~/tmp# ansible-playbook main.yml 

PLAY [r1] ************************************************************************************************************************************************************************

TASK [Gathering Facts] ***********************************************************************************************************************************************************
[WARNING]: Ignoring timeout(10) for ansible.legacy.vyos_facts
ok: [r1]

TASK [Configure ssh-keys on remote host 10.x.x.22] ****************************************************************************************************************************
[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
changed: [r1]

PLAY RECAP ***********************************************************************************************************************************************************************
r1                         : ok=2    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   

root@ansdeb:~/tmp#

Op-mode

root@ansdeb:~/tmp# ansible-playbook main.yml 

PLAY [r1] ************************************************************************************************************************************************************************

TASK [show version] **************************************************************************************************************************************************************
ok: [r1]

TASK [print output] **************************************************************************************************************************************************************
ok: [r1] => {
    "find_output": {
        "changed": false,
        "failed": false,
        "stdout": [
            "Version:          VyOS 1.3.1-S1\nRelease train:    equuleus\n\nBuilt by:         Sentrium S.L.\nBuilt on:         Mon 28 Mar 2022 17:02 UTC\nBuild UUID:       b89ffc4c-3c7e-4d89-91de-bd89e584c532\nBuild commit ID:  bfd58ad202462f\n\nArchitecture:     x86_64\nBoot via:         installed image\nSystem type:      KVM guest\n\nHardware vendor:  QEMU\nHardware model:   Standard PC (i440FX + PIIX, 1996)\nHardware S/N:     \nHardware UUID:    dbc708ca-6594-4b7b-b940-9a5f72b4675f\n\nCopyright:        VyOS maintainers and contributors"
        ],
        "stdout_lines": [
            [
                "Version:          VyOS 1.3.1-S1",
                "Release train:    equuleus",
                "",
                "Built by:         Sentrium S.L.",
                "Built on:         Mon 28 Mar 2022 17:02 UTC",
                "Build UUID:       b89ffc4c-3c7e-4d89-91de-bd89e584c532",
                "Build commit ID:  bfd58ad202462f",
                "",
                "Architecture:     x86_64",
                "Boot via:         installed image",
                "System type:      KVM guest",
                "",
                "Hardware vendor:  QEMU",
                "Hardware model:   Standard PC (i440FX + PIIX, 1996)",
                "Hardware S/N:     ",
                "Hardware UUID:    dbc708ca-6594-4b7b-b940-9a5f72b4675f",
                "",
                "Copyright:        VyOS maintainers and contributors"
            ]
        ]
    }
}

PLAY RECAP ***********************************************************************************************************************************************************************
r1                         : ok=2    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   

root@ansdeb:~/tmp# 

Hi

this is th playbook I’m using for all our Vyos routers succesfully, except for routers upgraded to 1.3.1-S1.


  • name: BackUp DMVPN SPOKE TEST router’s config

    hosts: XPi304r-XXX-Tarragona

    tasks:

    • name: Collect facts

      vyos.vyos.vyos_facts:

      gather_subset: all

    • name: Create backup dir

      file:

      path: “/home/ansible_adm/backups/YYYYYYY/TEST/{{ inventory_hostname }}”

      state: directory

      recurse: yes

    • name: Backup

      vyos.vyos.vyos_config:

      backup: yes

      backup_options:

      dir_path: "/home/ansible_adm/backups/YYYYYYY/TEST/{{ inventory_hostname  }}"
      
  • name: Delete Old BackUp Files

    hosts: XPi304r-XXX-Tarragona

    vars:

    backup_dir: “/home/ansible_adm/backups/YYYYYY/TEST/{{ inventory_hostname }}”

    backup_keep: 10

    dry_run: false

    tasks:

    • find:

      path: “{{ backup_dir }}”

      register: result

    • set_fact:

      files_rm: "{{ (result.files|

                  sort(attribute='mtime', reverse=true)|
      
                  map(attribute='path')|
      
                  list)[backup_keep:] }}"
      
    • debug:

      var: files_rm

    • file:

      state: absent

      path: “{{ item }}”

      loop: “{{ files_rm }}”

      when: not dry_run|bool

I have only one router with 1.3.1-S1 that fails ( I made downgrade to 1.3.1 for the otre two units). I can try with 1.3.1-S1, downgrade to 1.3.1 and try again if you need to check.

Hi again,

I made the test with same router config and hardware. Once with 1.3.1-S1, that fails:

jordi@XPi304r-YYYY-Tarragona:~$ show version

Version: VyOS Equuleus_1.3.1-S1
Release train: equuleus

Built by: Xperientia Business IT
Built on: Wed 30 Mar 2022 18:14 UTC
Build UUID: c5056816-6ce7-488b-9c7c-5cf2e259b7cb
Build commit ID: bfd58ad202462f

Architecture: x86_64
Boot via: installed image
System type: bare metal

Hardware vendor: Xperientia Systems
Hardware model: XP-i304r
Hardware S/N: Not Implemented
Hardware UUID: 03000200-0400-0500-0006-000700080009

Copyright: VyOS maintainers and contributors

ansible_adm@Ansible02:~/playbooks/AWX_Playbooks$ ansible-playbook Vyos_YYYYYTEST_Backup.yaml -vvvv --ask-pass
ansible-playbook 2.10.8
config file = /etc/ansible/ansible.cfg
configured module search path = [’/home/ansible_adm/.ansible/plugins/modules’, ‘/usr/share/ansible/plugins/modules’]
ansible python module location = /usr/lib/python3/dist-packages/ansible
executable location = /usr/bin/ansible-playbook
python version = 3.9.2 (default, Feb 28 2021, 17:03:44) [GCC 10.2.1 20210110]
Using /etc/ansible/ansible.cfg as config file
SSH password:
setting up inventory plugins
host_list declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
auto declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
Skipping empty key (hosts) in group (all)
Not replacing invalid character(s) “{’-’}” in group name (StQgat-2)
[WARNING]: Invalid characters were found in group names but not replaced, use -vvvv to see details
Parsed /etc/ansible/hosts inventory source with yaml plugin
Loading collection vyos.vyos from /home/ansible_adm/.ansible/collections/ansible_collections/vyos/vyos
redirecting (type: action) vyos.vyos.vyos_facts to vyos.vyos.vyos
redirecting (type: action) vyos.vyos.vyos_config to vyos.vyos.vyos
Loading callback plugin default of type stdout, v2.0 from /usr/lib/python3/dist-packages/ansible/plugins/callback/default.py
Skipping callback ‘default’, as we already have a stdout callback.
Skipping callback ‘minimal’, as we already have a stdout callback.
Skipping callback ‘oneline’, as we already have a stdout callback.

PLAYBOOK: Vyos_YYYYYTEST_Backup.yaml ************************************************************************************************************************************************************
Positional arguments: Vyos_YYYYYTEST_Backup.yaml
verbosity: 4
ask_pass: True
connection: smart
timeout: 10
become_method: sudo
tags: (‘all’,)
inventory: (’/etc/ansible/hosts’,)
forks: 5
2 plays in Vyos_YYYYYTEST_Backup.yaml

PLAY [BackUp OCA DMVPN SPOKE TEST router’s config] *********************************************************************************************************************************************

TASK [Gathering Facts] *************************************************************************************************************************************************************************
task path: /home/ansible_adm/playbooks/AWX_Playbooks/Vyos_YYYYYTEST_Backup.yaml:4
Loading collection ansible.netcommon from /home/ansible_adm/.ansible/collections/ansible_collections/ansible/netcommon
<95.124.240.39> attempting to start connection
<95.124.240.39> using connection plugin ansible.netcommon.network_cli
Found ansible-connection at path /usr/bin/ansible-connection
<95.124.240.39> local domain socket does not exist, starting it
<95.124.240.39> control socket path is /home/ansible_adm/.ansible/pc/135d7c9f5c
<95.124.240.39> Loading collection ansible.netcommon from /home/ansible_adm/.ansible/collections/ansible_collections/ansible/netcommon
<95.124.240.39> Loading collection vyos.vyos from /home/ansible_adm/.ansible/collections/ansible_collections/vyos/vyos
<95.124.240.39> local domain socket listeners started successfully
<95.124.240.39> loaded cliconf plugin ansible_collections.vyos.vyos.plugins.cliconf.vyos from path /home/ansible_adm/.ansible/collections/ansible_collections/vyos/vyos/plugins/cliconf/vyos.py for network_os vyos.vyos.vyos
<95.124.240.39> ssh type is set to paramiko
<95.124.240.39>
<95.124.240.39> local domain socket path is /home/ansible_adm/.ansible/pc/135d7c9f5c
[WARNING]: Ignoring timeout(10) for vyos.vyos.vyos_facts
<95.124.240.39> ESTABLISH LOCAL CONNECTION FOR USER: ansible_adm
<95.124.240.39> EXEC /bin/sh -c ‘( umask 77 && mkdir -p “echo /home/ansible_adm/.ansible/tmp/ansible-local-14619wxbfy2ka”&& mkdir “echo /home/ansible_adm/.ansible/tmp/ansible-local-14619wxbfy2ka/ansible-tmp-1651567464.1295493-14625-69279887720186” && echo ansible-tmp-1651567464.1295493-14625-69279887720186="echo /home/ansible_adm/.ansible/tmp/ansible-local-14619wxbfy2ka/ansible-tmp-1651567464.1295493-14625-69279887720186" ) && sleep 0’
Attempting python interpreter discovery
<95.124.240.39> EXEC /bin/sh -c ‘echo PLATFORM; uname; echo FOUND; command -v ‘"’"’/usr/bin/python’"’"’; command -v ‘"’"‘python3.9’"’"’; command -v ‘"’"‘python3.8’"’"’; command -v ‘"’"‘python3.7’"’"’; command -v ‘"’"‘python3.6’"’"’; command -v ‘"’"‘python3.5’"’"’; command -v ‘"’"‘python2.7’"’"’; command -v ‘"’"‘python2.6’"’"’; command -v ‘"’"’/usr/libexec/platform-python’"’"’; command -v ‘"’"’/usr/bin/python3’"’"’; command -v ‘"’"‘python’"’"’; echo ENDFOUND && sleep 0’
<95.124.240.39> EXEC /bin/sh -c ‘/usr/bin/python3.9 && sleep 0’
Using module file /home/ansible_adm/.ansible/collections/ansible_collections/vyos/vyos/plugins/modules/vyos_facts.py
<95.124.240.39> PUT /home/ansible_adm/.ansible/tmp/ansible-local-14619wxbfy2ka/tmpxwysr4iw TO /home/ansible_adm/.ansible/tmp/ansible-local-14619wxbfy2ka/ansible-tmp-1651567464.1295493-14625-69279887720186/AnsiballZ_vyos_facts.py
<95.124.240.39> EXEC /bin/sh -c ‘chmod u+x /home/ansible_adm/.ansible/tmp/ansible-local-14619wxbfy2ka/ansible-tmp-1651567464.1295493-14625-69279887720186/ /home/ansible_adm/.ansible/tmp/ansible-local-14619wxbfy2ka/ansible-tmp-1651567464.1295493-14625-69279887720186/AnsiballZ_vyos_facts.py && sleep 0’
<95.124.240.39> EXEC /bin/sh -c ‘/usr/bin/python3 /home/ansible_adm/.ansible/tmp/ansible-local-14619wxbfy2ka/ansible-tmp-1651567464.1295493-14625-69279887720186/AnsiballZ_vyos_facts.py && sleep 0’
<95.124.240.39> EXEC /bin/sh -c ‘rm -f -r /home/ansible_adm/.ansible/tmp/ansible-local-14619wxbfy2ka/ansible-tmp-1651567464.1295493-14625-69279887720186/ > /dev/null 2>&1 && sleep 0’

fatal: [XPi304rYYYYYTarragona]: FAILED! => {
** “ansible_facts”: {},**
** “changed”: false,**
** “failed_modules”: {**
** “vyos.vyos.vyos_facts”: {**
** “ansible_facts”: {**
** “discovered_interpreter_python”: “/usr/bin/python3”**
** },**
** “exception”: " File “/tmp/ansible_vyos.vyos.vyos_facts_payload_egz4ahgj/ansible_vyos.vyos.vyos_facts_payload.zip/ansible_collections/ansible/netcommon/plugins/module_utils/network/common/network.py”, line 251, in get_capabilities\n capabilities = Connection(module._socket_path).get_capabilities()\n File “/tmp/ansible_vyos.vyos.vyos_facts_payload_egz4ahgj/ansible_vyos.vyos.vyos_facts_payload.zip/ansible/module_utils/connection.py”, line 195, in rpc\n raise ConnectionError(to_text(msg, errors=‘surrogate_then_replace’), code=code)\n",**
** “failed”: true,**
** “invocation”: {**
** “module_args”: {**
** “available_network_resources”: false,**
** “gather_network_resources”: null,**
** “gather_subset”: [**
** “!config”**
** ],**
** “provider”: null**
** }**
** },**
** “msg”: "show version\r\n\r\n Invalid command: [show]\r\n\r\nansible_adm@XPi304rYYYYYTarragona:~$ "**
** }**
** },**
** “msg”: “The following modules failed to execute: vyos.vyos.vyos_facts\n”**
}

PLAY RECAP *************************************************************************************************************************************************************************************
XPi304rYYYYYTarragona : ok=0 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0

and another time with downgrade to 1.3.1, that works

jordi@XPi304r-YYYY-Tarragona:~$ sh version

Version: VyOS Vyos Equuleus_1.3.1
Release train: equuleus

Built by: Xperientia Business IT
Built on: Tue 22 Mar 2022 06:49 UTC
Build UUID: dc496c20-1d6a-4193-b35c-65e5d0d07e5f
Build commit ID: 1c96b450e598ed

Architecture: x86_64
Boot via: installed image
System type: bare metal

Hardware vendor: Xperientia Systems
Hardware model: XP-i304r
Hardware S/N: Not Implemented
Hardware UUID: 03000200-0400-0500-0006-000700080009

Copyright: VyOS maintainers and contributors
jordi@XPi304r-YYYY-Tarragona:~$

ansible_adm@Ansible02:~/playbooks/AWX_Playbooks$ ansible-playbook Vyos_YYYY_TEST_Backup.yaml --ask-pass
SSH password:
[WARNING]: Invalid characters were found in group names but not replaced, use -vvvv to see details

PLAY [BackUp YYYYY DMVPN SPOKE TEST router’s config] *********************************************************************************************************************************************

TASK [Gathering Facts] *************************************************************************************************************************************************************************
[WARNING]: Ignoring timeout(10) for vyos.vyos.vyos_facts
ok: [XPi304rYYYYY-Tarragona]

TASK [Collect facts] ***************************************************************************************************************************************************************************
ok: [XPi304rYYYYY-Tarragona]

TASK [Create backup dir] ***********************************************************************************************************************************************************************
ok: [XPi304rYYYYY-Tarragona]

TASK [Backup] **********************************************************************************************************************************************************************************
changed: [XPi304rYYYYY-Tarragona]

PLAY [Delete Old BackUp Files] *****************************************************************************************************************************************************************

TASK [Gathering Facts] *************************************************************************************************************************************************************************
[WARNING]: Ignoring timeout(10) for vyos.vyos.vyos_facts
ok: [XPi304rYYYYY-Tarragona]

TASK [find] ************************************************************************************************************************************************************************************
ok: [XPi304rYYYYY-Tarragona]

TASK [set_fact] ********************************************************************************************************************************************************************************
ok: [XPi304rYYYYY-Tarragona]

TASK [debug] ***********************************************************************************************************************************************************************************
ok: [XPi304rYYYYY-Tarragona] => {
“files_rm”: []
}

TASK [file] ************************************************************************************************************************************************************************************

PLAY RECAP *************************************************************************************************************************************************************************************
XPi304rYYYYY-Tarragona : ok=8 changed=1 unreachable=0 failed=0 skipped=1 rescued=0 ignored=0

ansible_adm@Ansible02:~/playbooks/AWX_Playbooks$

regards