Coder Social home page Coder Social logo

vyos.vyos's Introduction

VyOS Collection

Codecov CI

The Ansible VyOS collection includes a variety of Ansible content to help automate the management of VyOS network appliances.

This collection has been tested against VyOS 1.1.8 (helium).

Ansible version compatibility

This collection has been tested against following Ansible versions: >=2.15.0.

For collections that support Ansible 2.9, please ensure you update your network_os to use the fully qualified collection name (for example, cisco.ios.ios). Plugins and modules within a collection may be tested with only specific Ansible versions. A collection may contain metadata that identifies these versions. PEP440 is the schema used to describe the versions of Ansible.

Supported connections

The VyOS collection supports network_cli connections.

Included content

Cliconf plugins

Name Description
vyos.vyos.vyos Use vyos cliconf to run command on VyOS platform

Modules

Name Description
vyos.vyos.vyos_banner Manage multiline banners on VyOS devices
vyos.vyos.vyos_bgp_address_family BGP Address Family Resource Module.
vyos.vyos.vyos_bgp_global BGP Global Resource Module.
vyos.vyos.vyos_command Run one or more commands on VyOS devices
vyos.vyos.vyos_config Manage VyOS configuration on remote device
vyos.vyos.vyos_facts Get facts about vyos devices.
vyos.vyos.vyos_firewall_global FIREWALL global resource module
vyos.vyos.vyos_firewall_interfaces FIREWALL interfaces resource module
vyos.vyos.vyos_firewall_rules FIREWALL rules resource module
vyos.vyos.vyos_hostname Manages hostname resource module
vyos.vyos.vyos_interfaces Interfaces resource module
vyos.vyos.vyos_l3_interfaces L3 interfaces resource module
vyos.vyos.vyos_lag_interfaces LAG interfaces resource module
vyos.vyos.vyos_lldp_global LLDP global resource module
vyos.vyos.vyos_lldp_interfaces LLDP interfaces resource module
vyos.vyos.vyos_logging Manage logging on network devices
vyos.vyos.vyos_logging_global Logging resource module
vyos.vyos.vyos_ntp_global Manages ntp modules of Vyos network devices
vyos.vyos.vyos_ospf_interfaces OSPF Interfaces Resource Module.
vyos.vyos.vyos_ospfv2 OSPFv2 resource module
vyos.vyos.vyos_ospfv3 OSPFV3 resource module
vyos.vyos.vyos_ping Tests reachability using ping from VyOS network devices
vyos.vyos.vyos_prefix_lists Prefix-Lists resource module for VyOS
vyos.vyos.vyos_route_maps Route Map Resource Module.
vyos.vyos.vyos_snmp_server Manages snmp_server resource module
vyos.vyos.vyos_static_routes Static routes resource module
vyos.vyos.vyos_system Run set system commands on VyOS devices
vyos.vyos.vyos_user Manage the collection of local users on VyOS device
vyos.vyos.vyos_vlan Manage VLANs on VyOS network devices

Click the Content button to see the list of content included in this collection.

Installing this collection

You can install the VyOS collection with the Ansible Galaxy CLI:

ansible-galaxy collection install vyos.vyos

You can also include it in a requirements.yml file and install it with ansible-galaxy collection install -r requirements.yml, using the format:

---
collections:
  - name: vyos.vyos

Using this collection

This collection includes network resource modules.

Using modules from the VyOS collection in your playbooks

You can call modules by their Fully Qualified Collection Namespace (FQCN), such as vyos.vyos.vyos_static_routes. The following example task replaces configuration changes in the existing configuration on a VyOS network device, using the FQCN:

---
  - name: Replace device configurations of listed static routes with provided
      configurations
    register: result
    vyos.vyos.vyos_static_routes: &id001
      config:

        - address_families:

            - afi: ipv4
              routes:

                - dest: 192.0.2.32/28
                  blackhole_config:
                    distance: 2
                  next_hops:

                    - forward_router_address: 192.0.2.7

                    - forward_router_address: 192.0.2.8

                    - forward_router_address: 192.0.2.9
      state: replaced

NOTE: For Ansible 2.9, you may not see deprecation warnings when you run your playbooks with this collection. Use this documentation to track when a module is deprecated.

See Also:

Contributing to this collection

We welcome community contributions to this collection. If you find problems, please open an issue or create a PR against the VyOS collection repository. See Contributing to Ansible-maintained collections for complete details.

You can also join us on:

See the Ansible Community Guide for details on contributing to Ansible.

Code of Conduct

This collection follows the Ansible project's Code of Conduct. Please read and familiarize yourself with this document.

Changelogs

Release notes

Release notes are available here.

Roadmap

More information

Licensing

GNU General Public License v3.0 or later.

See LICENSE to see the full text.

vyos.vyos's People

Contributors

andersson007 avatar anguswarren avatar ansible-zuul[bot] avatar ashwini-mhatre avatar bgh88 avatar bk2zsto avatar bmillemathias avatar brahmanim avatar capttrews avatar charlie-root avatar chenxiaolong avatar dericcrago avatar dmsimard avatar ganeshrn avatar gomathiselvis avatar justjais avatar kb-perbyte avatar nilashishc avatar pabelanger avatar pre-commit-ci[bot] avatar priyamsahoo avatar qalthos avatar rfranks-securenet avatar rohitthakur2590 avatar roverflow avatar samccann avatar sdwilsh avatar spredzy avatar wfdewith avatar yvarshitha avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vyos.vyos's Issues

State "overridden" not working properly

SUMMARY

State "overridden" not correctly delete rules when new rules use the same number

If the existing rule has the destination port and I want to use "overridden" to set rule with the source port (same number), the new rule will have both

ISSUE TYPE
  • Bug Report
COMPONENT NAME

vyos_firewall_rules (maybe others)

ANSIBLE VERSION
❯ ansible --version
ansible 2.10.7
  config file = None
  configured module search path = ['/Users/filda/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /opt/homebrew/Cellar/ansible/3.2.0/libexec/lib/python3.9/site-packages/ansible
  executable location = /opt/homebrew/bin/ansible
  python version = 3.9.4 (default, Apr  4 2021, 17:42:23) [Clang 12.0.0 (clang-1200.0.32.29)]
CONFIGURATION
COLLECTIONS_PATHS(/Users/filda/Documents/PVyos/network/ansible.cfg) = ['/Users/filda/Documents/PVyos/network/ansible/collections']
DEFAULT_MODULE_PATH(/Users/filda/Documents/PVyos/network/ansible.cfg) = ['/Users/filda/Documents/PVyos/network/ansible/modules']
DEPRECATION_WARNINGS(/Users/filda/Documents/PVyos/network/ansible.cfg) = False
HOST_KEY_CHECKING(/Users/filda/Documents/PVyos/network/ansible.cfg) = False
INTERPRETER_PYTHON(/Users/filda/Documents/PVyos/network/ansible.cfg) = /usr/bin/python3
OS / ENVIRONMENT

Version: VyOS 1.4-rolling-202104091411
Release Train: sagitta

Built by: [email protected]
Built on: Fri 09 Apr 2021 12:16 UTC
Build UUID: 2036e80c-34a1-4429-9f35-1869cca76500
Build Commit ID: b3ba57ac9423a9

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: 3f026c93-de24-4bfc-9476-42157a49e281

Copyright: VyOS maintainers and contributors

STEPS TO REPRODUCE
set firewall group address-group Public4_IPs address '1.1.1.1'
set firewall group address-group Public4_IPs description 'Public IP'
set firewall name WAN-GW rule 1 action 'accept'
set firewall name WAN-GW rule 1 description 'Accept already established connections'
set firewall name WAN-GW rule 1 state established 'enable'
set firewall name WAN-GW rule 1 state related 'enable'
set firewall name WAN-GW rule 2 action 'accept'
set firewall name WAN-GW rule 2 description 'Accept routers keepalive'
set firewall name WAN-GW rule 2 destination port '694'
set firewall name WAN-GW rule 2 protocol 'udp'
set firewall name WAN-GW rule 2 source group address-group 'Public4_IPs'
set firewall name WAN-GW rule 3 action 'accept'
set firewall name WAN-GW rule 3 description 'Accept wireguard connection'
set firewall name WAN-GW rule 3 destination port '51820'
set firewall name WAN-GW rule 3 protocol 'udp'
set firewall name WAN-IN rule 1 action 'accept'
set firewall name WAN-IN rule 1 description 'Accept already established connections'
set firewall name WAN-IN rule 1 state established 'enable'
set firewall name WAN-IN rule 1 state related 'enable'
- name: Setting firewall rules
  vyos.vyos.vyos_firewall_rules:
    config:
      - afi: ipv4
        rule_sets:
        - name: WAN-GW
          description: Communication from WAN to GW
          default_action: drop
          rules:
            - description: Accept routers keepalive
              action: accept
              number: 2
              protocol: "udp"
              destination:
                port: "1111"
            - description: Accept routers keepalive
              action: accept
              number: 3
              protocol: "udp"
              source:
                port: "2222"
    state: overridden
EXPECTED RESULTS
  1. Delete all rules

delete firewall name WAN-IN
delete firewall name WAN-GW

  1. Set new rules

set firewall name WAN-GW rule 2 description "Accept routers keepalive"
set firewall name WAN-GW rule 2 action "accept"
set firewall name WAN-GW rule 2 protocol "udp"
set firewall name WAN-GW rule 2 destination port "1111"
set firewall name WAN-GW rule 3 description "Accept routers keepalive"
set firewall name WAN-GW rule 3 action "accept"
set firewall name WAN-GW rule 3 protocol "udp"
set firewall name WAN-GW rule 3 source port "2222"

ACTUAL RESULTS

delete firewall name WAN-GW rule 1
delete firewall name WAN-IN
set firewall name WAN-GW rule 2 destination port 1111
set firewall name WAN-GW rule 3 description 'Accept routers keepalive'
set firewall name WAN-GW rule 3 source port 2222

"before": [
    {
        "afi": "ipv4",
        "rule_sets": [
            {
                "default_action": "drop",
                "description": "Communication from WAN to GW",
                "name": "WAN-GW",
                "rules": [
                    {
                        "action": "accept",
                        "description": "Accept already established connections",
                        "number": 1,
                        "state": {
                            "established": true,
                            "related": true
                        }
                    },
                    {
                        "action": "accept",
                        "description": "Accept routers keepalive",
                        "destination": {
                            "port": "694"
                        },
                        "number": 2,
                        "protocol": "udp",
                        "source": {
                            "group": {
                                "address_group": "Public4_IPs"
                            }
                        }
                    },
                    {
                        "action": "accept",
                        "description": "Accept wireguard connection",
                        "destination": {
                            "port": "51820"
                        },
                        "number": 3,
                        "protocol": "udp"
                    }
                ]
            },
            {
                "default_action": "drop",
                "description": "Communication from WAN through GW",
                "name": "WAN-IN",
                "rules": [
                    {
                        "action": "accept",
                        "description": "Accept already established connections",
                        "number": 1,
                        "state": {
                            "established": true,
                            "related": true
                        }
                    }
                ]
            }
        ]
    }
],
"changed": true,
"commands": [
    "delete firewall name WAN-GW rule 1",
    "delete firewall name WAN-IN",
    "set firewall name WAN-GW rule 2 destination port 1111",
    "set firewall name WAN-GW rule 3 description 'Accept routers keepalive'",
    "set firewall name WAN-GW rule 3 source port 2222"
],
"invocation": {
    "module_args": {
        "config": [
            {
                "afi": "ipv4",
                "rule_sets": [
                    {
                        "default_action": "drop",
                        "description": "Communication from WAN to GW",
                        "enable_default_log": null,
                        "name": "WAN-GW",
                        "rules": [
                            {
                                "action": "accept",
                                "description": "Accept routers keepalive",
                                "destination": {
                                    "port": "1111"
                                },
                                "number": 2,
                                "protocol": "udp"
                            },
                            {
                                "action": "accept",
                                "description": "Accept routers keepalive",
                                "number": 3,
                                "protocol": "udp",
                                "source": {
                                    "port": "2222"
                                }
                            }
                        ]
                    }
                ]
            }
        ],
        "running_config": null,
        "state": "overridden"
    }
}

vyos_static_routes cannot be used to create interface-routes due to requirement for a forward router address

SUMMARY

The vyos_static_routes module requires that a forward_router_address be specified on each route. This precludes use of this module to create static interface-route entries in the VyOS configuration.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

vyos.vyos.vyos_static_routes

ANSIBLE VERSION
ansible 2.9.10
  config file = /Users/matt/code/ziglu/i12e/gps/vpn/ansible/ansible.cfg
  configured module search path = ['/Users/matt/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/Cellar/ansible/2.9.10/libexec/lib/python3.8/site-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 3.8.3 (default, May 27 2020, 20:54:22) [Clang 11.0.3 (clang-1103.0.32.59)]

CONFIGURATION
n/a
OS / ENVIRONMENT

VyOS hosts, but problem is with the module's API surface in the latest release, so not really applicable

STEPS TO REPRODUCE
- vyos.vyos.vyos_static_routes:
     config:
       - address_families:
           - afi: ipv4
             routes:
               - destination: "192.168.0.0/24"
                 next_hops:
                   - interface: eth1
EXPECTED RESULTS

An interface-route is created in the VyOS config as follows:

protocols {
    static {
        interface-route 192.168.0.0/24 {
            next-hop-interface eth1 {
            }
        }
    }
}
ACTUAL RESULTS

The run fails because forward_router_address is a required argument for the module.

fatal: [hostname]: FAILED! => changed=false
  msg: 'missing required arguments: forward_router_address found in config -> address_families -> routes -> next_hops'

Support v6 addresses in `vyos_firewall_global` groups

SUMMARY

address_group and network_group only support v4 addresses. It should also support v6 addresses.

ISSUE TYPE
  • Feature Idea
COMPONENT NAME

vyos_firewall_global

ADDITIONAL INFORMATION

The easiest way to support this would likely be to add an afi on these that defaults to ipv4 for backwards compatibility.

Important information for collection maintainers

SUMMARY

Dear maintainers,

This is important for your collections!

  • In accordance with the Community decision, we have created the news-for-maintainers repository for announcements of changes impacting collection maintainers (see the examples) instead of Issue 45 that will be closed soon.

    • To keep yourself well-informed and, therefore, things in your collection working, please subscribe to the repository by using the Watch button in the upper right corner on the repository's home page.
    • If you do not want to get notifications about related discussions, please subscribe only to Issues.
    • Please read the brief guidelines on how the repository should be used.
    • Please avoid unnecessary discussions in issues, use the Discussions feature. Every comment posted will notify a lot of folks!
  • Also we would like to remind you about the Bullhorn contributor newsletter which has recently started to be released weekly. To learn what it looks like, see the past releases. Please subscribe and talk to the Community via Bullhorn!

  • Join us in #ansible-social (for news reporting & chat), #ansible-community (for discussing collection & maintainer topics), and other channels on Matrix/IRC.

  • Help the Community and the Steering Committee to make right decisions by taking part in discussing and voting on the Community Topics that impact the whole project and the collections in particular. Your opinion there will be much appreciated!

Thank you!

vyos_static_routes uses incorrect attribute name interface

SUMMARY

While trying to assign a next-hop-interface to a static route, I get an error message saying 'interface' is not a valid parameter.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

vyos.vyos.vyos_static_routes

ANSIBLE VERSION
ansible 2.10.9
  config file = /home/bgh/Documents/git/vyos-ansible/ansible/ansible.cfg
  configured module search path = ['/home/bgh/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/bgh/.local/share/virtualenvs/vyos-ansible-5DGVl3Ve/lib/python3.8/site-packages/ansible
  executable location = /home/bgh/.local/share/virtualenvs/vyos-ansible-5DGVl3Ve/bin/ansible
  python version = 3.8.5 (default, Jan 27 2021, 15:41:15) [GCC 9.3.0]

CONFIGURATION
N/A
OS / ENVIRONMENT

Target OS versions

show version

Version:          VyOS 1.4-rolling-202102040221
Release Train:    sagitta

Built by:         [email protected]
Built on:         Thu 04 Feb 2021 02:21 UTC
Build UUID:       e1e89515-a7dc-4060-bbef-819e3c526b55
Build Commit ID:  38fa98af45d6c2

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:    65839fa9-8b9a-431d-b833-37c8402ab84c

Copyright:        VyOS maintainers and contributors
STEPS TO REPRODUCE
  1. Playbook that includes a task to set next hop interface
- name: Vyos Provisioning
  hosts: all
  collections:
    - vyos.vyos

  tasks:
    - name: Next hop interface
      include_tasks: tasks/vyos_next_hop_interface.yml
  1. The task file
- name: Adds a next hop interface
  vyos.vyos.vyos_static_routes:
    config:
    - address_families:
      - afi: ipv4
        routes:
        - dest: 1.2.3.4/32
          next_hops:
            - forward_router_address: 10.1.0.1
              interface: "eth0"
    state: replaced
EXPECTED RESULTS

The vyos command should include next-hop-interface instead of interface

set protocols static route 1.2.3.4/32 next-hop 10.1.0.1 next-hop-interface eth0

ACTUAL RESULTS
The full traceback is:
Traceback (most recent call last):
  File "/home/bgh/.ansible/tmp/ansible-local-274413c6e8c6lq/ansible-tmp-1621326342.4636068-274737-176821807976548/AnsiballZ_vyos_static_routes.py", line 102, in <module>
    _ansiballz_main()
  File "/home/bgh/.ansible/tmp/ansible-local-274413c6e8c6lq/ansible-tmp-1621326342.4636068-274737-176821807976548/AnsiballZ_vyos_static_routes.py", line 94, in _ansiballz_main
    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
  File "/home/bgh/.ansible/tmp/ansible-local-274413c6e8c6lq/ansible-tmp-1621326342.4636068-274737-176821807976548/AnsiballZ_vyos_static_routes.py", line 40, in invoke_module
    runpy.run_module(mod_name='ansible_collections.vyos.vyos.plugins.modules.vyos_static_routes', init_globals=None, run_name='__main__', alter_sys=True)
  File "/usr/lib/python3.8/runpy.py", line 207, in run_module
    return _run_module_code(code, init_globals, run_name, mod_spec)
  File "/usr/lib/python3.8/runpy.py", line 97, in _run_module_code
    _run_code(code, mod_globals, init_globals,
  File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/tmp/ansible_vyos.vyos.vyos_static_routes_payload_3pt8ugxm/ansible_vyos.vyos.vyos_static_routes_payload.zip/ansible_collections/vyos/vyos/plugins/modules/vyos_static_routes.py", line 937, in <module>
  File "/tmp/ansible_vyos.vyos.vyos_static_routes_payload_3pt8ugxm/ansible_vyos.vyos.vyos_static_routes_payload.zip/ansible_collections/vyos/vyos/plugins/modules/vyos_static_routes.py", line 932, in main
  File "/tmp/ansible_vyos.vyos.vyos_static_routes_payload_3pt8ugxm/ansible_vyos.vyos.vyos_static_routes_payload.zip/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/config/static_routes/static_routes.py", line 91, in execute_module
  File "/tmp/ansible_vyos.vyos.vyos_static_routes_payload_3pt8ugxm/ansible_vyos.vyos.vyos_static_routes_payload.zip/ansible/module_utils/connection.py", line 195, in __rpc__
ansible.module_utils.connection.ConnectionError: set protocols static route 1.2.3.4/32 next-hop 10.1.0.1 interface 'eth0'

  Configuration path: protocols static route 1.2.3.4/32 next-hop 10.1.0.1 [interface] is not valid
  Set failed

[edit]
vyos@vyos-rt-2# 
fatal: [vyos-rt-2]: FAILED! => {
    "changed": false,
    "module_stderr": "Traceback (most recent call last):\n  File \"/home/bgh/.ansible/tmp/ansible-local-274413c6e8c6lq/ansible-tmp-1621326342.4636068-274737-176821807976548/AnsiballZ_vyos_static_routes.py\", line 102, in <module>\n    _ansiballz_main()\n  File \"/home/bgh/.ansible/tmp/ansible-local-274413c6e8c6lq/ansible-tmp-1621326342.4636068-274737-176821807976548/AnsiballZ_vyos_static_routes.py\", line 94, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n  File \"/home/bgh/.ansible/tmp/ansible-local-274413c6e8c6lq/ansible-tmp-1621326342.4636068-274737-176821807976548/AnsiballZ_vyos_static_routes.py\", line 40, in invoke_module\n    runpy.run_module(mod_name='ansible_collections.vyos.vyos.plugins.modules.vyos_static_routes', init_globals=None, run_name='__main__', alter_sys=True)\n  File \"/usr/lib/python3.8/runpy.py\", line 207, in run_module\n    return _run_module_code(code, init_globals, run_name, mod_spec)\n  File \"/usr/lib/python3.8/runpy.py\", line 97, in _run_module_code\n    _run_code(code, mod_globals, init_globals,\n  File \"/usr/lib/python3.8/runpy.py\", line 87, in _run_code\n    exec(code, run_globals)\n  File \"/tmp/ansible_vyos.vyos.vyos_static_routes_payload_3pt8ugxm/ansible_vyos.vyos.vyos_static_routes_payload.zip/ansible_collections/vyos/vyos/plugins/modules/vyos_static_routes.py\", line 937, in <module>\n  File \"/tmp/ansible_vyos.vyos.vyos_static_routes_payload_3pt8ugxm/ansible_vyos.vyos.vyos_static_routes_payload.zip/ansible_collections/vyos/vyos/plugins/modules/vyos_static_routes.py\", line 932, in main\n  File \"/tmp/ansible_vyos.vyos.vyos_static_routes_payload_3pt8ugxm/ansible_vyos.vyos.vyos_static_routes_payload.zip/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/config/static_routes/static_routes.py\", line 91, in execute_module\n  File \"/tmp/ansible_vyos.vyos.vyos_static_routes_payload_3pt8ugxm/ansible_vyos.vyos.vyos_static_routes_payload.zip/ansible/module_utils/connection.py\", line 195, in __rpc__\nansible.module_utils.connection.ConnectionError: set protocols static route 1.2.3.4/32 next-hop 10.1.0.1 interface 'eth0'\r\n\r\n  Configuration path: protocols static route 1.2.3.4/32 next-hop 10.1.0.1 [interface] is not valid\r\n  Set failed\r\n\r\n[edit]\r\r\nvyos@vyos-rt-2# \n",
    "module_stdout": "",
    "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
    "rc": 1
}

protocols static route 1.2.3.4/32 next-hop 10.1.0.1 [interface] is not valid

issue in route-maps facts code when route-maps facts are empty.

SUMMARY

route_maps which are list of dictionaries, the facts output is correct when they are populated, but when the output is empty, it shows the key-value pair as "before": {} rather than showing "before": []

ISSUE TYPE
  • Bug Report
COMPONENT NAME

vyos_route_maps

ANSIBLE VERSION

COLLECTION VERSION

CONFIGURATION

OS / ENVIRONMENT
STEPS TO REPRODUCE
EXPECTED RESULTS
ACTUAL RESULTS

[Firewall] Manage bonding interface for Rule-Set

SUMMARY

Add interface firewalling for bonding interface

In the module, it's impossible to chose interface ethernet or interface bonding

ISSUE TYPE
  • Feature Idea
COMPONENT NAME

Module : vyos.vyos.vyos_firewall_interfaces (https://github.com/ansible-collections/vyos.vyos/blob/main/docs/vyos.vyos.vyos_firewall_interfaces_module.rst#vyosvyosvyos_firewall_interfaces)

ADDITIONAL INFORMATION

When I run vyos.vyos, the module always run this command :

set interfaces ethernet bond0 firewall in name test

Instead of :
set interfaces bonding bond0 firewall in name test

TEST

Configuration :

bonding bond0 {
     address 192.168.0.254/24
     hash-policy layer2+3
     member {
         interface eth2
         interface eth3
     }
 }
 ethernet eth0 {
     address dhcp
 }

Yaml for test :

- name: Merge the provided configuration with the existing running configuration
  vyos.vyos.vyos_firewall_interfaces:
    config: 
    - name: bond0
      access_rules:
      - afi: ipv4
        rules:
        - name: fromINTERNET_ipv4
          direction: in
        - name: toINTERNET_ipv4
          direction: out
        - name: toLOCAL_ipv4
          direction: local    
    state: merged

KeyError on 'enabled' when attempting to configure interface not already represented in config

SUMMARY

I brought up a clean VyOS host and attempted to configure one of its interfaces, eth1. eth1 did not have any pre-existing configuration in the on-disk config and was disabled. When attempting to run the playbook described below, rather than enabling the interface, the ansible runner failed with error KeyError: 'enabled'. It appears the vyos_interfaces module assumes it will always have an enabled key in some configuration sections and does not handle the error raised when this key does not exist.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

vyos.vyos.vyos_interfaces

ANSIBLE VERSION
ansible 2.9.10
  config file = None
  configured module search path = ['/Users/matt/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/Cellar/ansible/2.9.10/libexec/lib/python3.8/site-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 3.8.3 (default, May 27 2020, 20:54:22) [Clang 11.0.3 (clang-1103.0.32.59)]
CONFIGURATION
[nil output]
OS / ENVIRONMENT

VyOS 1.2.5

STEPS TO REPRODUCE
  1. Bring up a new VyOS host which does not have any configuration sections for at least one interface
  2. Run the playbook below, substituting the NIC identity which has no configuration for eth1 as appropriate
- name: configure physical interfaces
  block:
    - name: ensure L2 configuration is applied to physical interfaces
      vyos.vyos.vyos_interfaces:
        config:
          - name: eth1
            description: Configured by Ansible.
            enabled: yes
            duplex: auto
            speed: auto
            vifs: []
        state: replaced
EXPECTED RESULTS

The interface eth1 is brought up with the configuration provided. The run completes without errors.

ACTUAL RESULTS

The following exception was raised:

The full traceback is:
Traceback (most recent call last):
  File "/Users/matt/.ansible/tmp/ansible-local-228616bbu14rn/ansible-tmp-1602007357.662739-22962-83805022306893/AnsiballZ_vyos_interfaces.py", line 102, in <module>
    _ansiballz_main()
  File "/Users/matt/.ansible/tmp/ansible-local-228616bbu14rn/ansible-tmp-1602007357.662739-22962-83805022306893/AnsiballZ_vyos_interfaces.py", line 94, in _ansiballz_main
    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
  File "/Users/matt/.ansible/tmp/ansible-local-228616bbu14rn/ansible-tmp-1602007357.662739-22962-83805022306893/AnsiballZ_vyos_interfaces.py", line 40, in invoke_module
    runpy.run_module(mod_name='ansible_collections.vyos.vyos.plugins.modules.vyos_interfaces', init_globals=None, run_name='__main__', alter_sys=True)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 188, in run_module
    fname, loader, pkg_name)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 82, in _run_module_code
    mod_name, mod_fname, mod_loader, pkg_name)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/var/folders/1_/7ll3cry521v04hn7pwt_k6l00000gn/T/ansible_vyos.vyos.vyos_interfaces_payload_9zMTVo/ansible_vyos.vyos.vyos_interfaces_payload.zip/ansible_collections/vyos/vyos/plugins/modules/vyos_interfaces.py", line 1134, in <module>
  File "/var/folders/1_/7ll3cry521v04hn7pwt_k6l00000gn/T/ansible_vyos.vyos.vyos_interfaces_payload_9zMTVo/ansible_vyos.vyos.vyos_interfaces_payload.zip/ansible_collections/vyos/vyos/plugins/modules/vyos_interfaces.py", line 1129, in main
  File "/var/folders/1_/7ll3cry521v04hn7pwt_k6l00000gn/T/ansible_vyos.vyos.vyos_interfaces_payload_9zMTVo/ansible_vyos.vyos.vyos_interfaces_payload.zip/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/config/interfaces/interfaces.py", line 80, in execute_module
  File "/var/folders/1_/7ll3cry521v04hn7pwt_k6l00000gn/T/ansible_vyos.vyos.vyos_interfaces_payload_9zMTVo/ansible_vyos.vyos.vyos_interfaces_payload.zip/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/config/interfaces/interfaces.py", line 124, in set_config
  File "/var/folders/1_/7ll3cry521v04hn7pwt_k6l00000gn/T/ansible_vyos.vyos.vyos_interfaces_payload_9zMTVo/ansible_vyos.vyos.vyos_interfaces_payload.zip/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/config/interfaces/interfaces.py", line 173, in set_state
  File "/var/folders/1_/7ll3cry521v04hn7pwt_k6l00000gn/T/ansible_vyos.vyos.vyos_interfaces_payload_9zMTVo/ansible_vyos.vyos.vyos_interfaces_payload.zip/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/config/interfaces/interfaces.py", line 186, in _state_replaced
  File "/var/folders/1_/7ll3cry521v04hn7pwt_k6l00000gn/T/ansible_vyos.vyos.vyos_interfaces_payload_9zMTVo/ansible_vyos.vyos.vyos_interfaces_payload.zip/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/config/interfaces/interfaces.py", line 286, in _state_deleted
KeyError: 'enabled'
fatal: [vyos-0]: FAILED! => changed=false
  module_stderr: |-
    Traceback (most recent call last):
      File "/Users/matt/.ansible/tmp/ansible-local-228616bbu14rn/ansible-tmp-1602007357.662739-22962-83805022306893/AnsiballZ_vyos_interfaces.py", line 102, in <module>
        _ansiballz_main()
      File "/Users/matt/.ansible/tmp/ansible-local-228616bbu14rn/ansible-tmp-1602007357.662739-22962-83805022306893/AnsiballZ_vyos_interfaces.py", line 94, in _ansiballz_main
        invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
      File "/Users/matt/.ansible/tmp/ansible-local-228616bbu14rn/ansible-tmp-1602007357.662739-22962-83805022306893/AnsiballZ_vyos_interfaces.py", line 40, in invoke_module
        runpy.run_module(mod_name='ansible_collections.vyos.vyos.plugins.modules.vyos_interfaces', init_globals=None, run_name='__main__', alter_sys=True)
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 188, in run_module
        fname, loader, pkg_name)
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 82, in _run_module_code
        mod_name, mod_fname, mod_loader, pkg_name)
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 72, in _run_code
        exec code in run_globals
      File "/var/folders/1_/7ll3cry521v04hn7pwt_k6l00000gn/T/ansible_vyos.vyos.vyos_interfaces_payload_9zMTVo/ansible_vyos.vyos.vyos_interfaces_payload.zip/ansible_collections/vyos/vyos/plugins/modules/vyos_interfaces.py", line 1134, in <module>
      File "/var/folders/1_/7ll3cry521v04hn7pwt_k6l00000gn/T/ansible_vyos.vyos.vyos_interfaces_payload_9zMTVo/ansible_vyos.vyos.vyos_interfaces_payload.zip/ansible_collections/vyos/vyos/plugins/modules/vyos_interfaces.py", line 1129, in main
      File "/var/folders/1_/7ll3cry521v04hn7pwt_k6l00000gn/T/ansible_vyos.vyos.vyos_interfaces_payload_9zMTVo/ansible_vyos.vyos.vyos_interfaces_payload.zip/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/config/interfaces/interfaces.py", line 80, in execute_module
      File "/var/folders/1_/7ll3cry521v04hn7pwt_k6l00000gn/T/ansible_vyos.vyos.vyos_interfaces_payload_9zMTVo/ansible_vyos.vyos.vyos_interfaces_payload.zip/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/config/interfaces/interfaces.py", line 124, in set_config
      File "/var/folders/1_/7ll3cry521v04hn7pwt_k6l00000gn/T/ansible_vyos.vyos.vyos_interfaces_payload_9zMTVo/ansible_vyos.vyos.vyos_interfaces_payload.zip/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/config/interfaces/interfaces.py", line 173, in set_state
      File "/var/folders/1_/7ll3cry521v04hn7pwt_k6l00000gn/T/ansible_vyos.vyos.vyos_interfaces_payload_9zMTVo/ansible_vyos.vyos.vyos_interfaces_payload.zip/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/config/interfaces/interfaces.py", line 186, in _state_replaced
      File "/var/folders/1_/7ll3cry521v04hn7pwt_k6l00000gn/T/ansible_vyos.vyos.vyos_interfaces_payload_9zMTVo/ansible_vyos.vyos.vyos_interfaces_payload.zip/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/config/interfaces/interfaces.py", line 286, in _state_deleted
    KeyError: 'enabled'
  module_stdout: ''
  msg: |-
    MODULE FAILURE
    See stdout/stderr for the exact error
  rc: 1

The VyOS config has no configuration committed for eth1:

$ show configuration commands | grep inter
set interfaces ethernet eth0 address 'dhcp'
set interfaces ethernet eth0 duplex 'auto'
set interfaces ethernet eth0 speed 'auto'
set interfaces loopback lo

VRRP support

SUMMARY

Add support for VRRP configuration

ISSUE TYPE
  • Feature Idea
COMPONENT NAME

It could be named "vyos.vyos.vyos_vrrp"

ADDITIONAL INFORMATION

It would be nice to configure VRRP using an dedicated ansible module, not only via vyos.vyos.vyos_config.
Please see example task below - would it be hard to implement it as a module?

---
# add a vif interface with description (without static address), then configure vrrp for them
- name: configure vrrp for vlan {{ vlan }} on '{{ inventory_hostname }}' router
  vyos.vyos.vyos_config:
    lines:
      - set interfaces {{ router_main_interface_type }} {{ router_main_interface }} vif {{ vlan }} description '{{ vlan_description }}'
      - set high-availability vrrp group VLAN-{{ vlan }} description '{{ vlan_description }}'
      - set high-availability vrrp group VLAN-{{ vlan }} hello-source-address '{{ router_hello_source_address }}'
      - set high-availability vrrp group VLAN-{{ vlan }} interface '{{ router_main_interface}}.{{ vlan }}'
      - set high-availability vrrp group VLAN-{{ vlan }} priority '{{ router_vrrp_priority }}'
      - set high-availability vrrp group VLAN-{{ vlan }} virtual-address '{{ router_interface_ip }}/{{ mask_bits }}'
      - set high-availability vrrp group VLAN-{{ vlan }} vrid '{{ vrid }}'

vyos_facts not working with ansible==2.10

SUMMARY

Using vyos_facts does not work when using ansible==2.10

ISSUE TYPE
  • Bug Report
COMPONENT NAME

vyos_facts

ANSIBLE VERSION

CONFIGURATION
ansible-config dump --only-changed
DEFAULT_VAULT_PASSWORD_FILE(env: ANSIBLE_VAULT_PASSWORD_FILE) = /home/ops/.secret

ansible --version
ansible 2.10.3
  config file = None
  configured module search path = ['/home/ops/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/ops/test/venv-2.10/lib/python3.6/site-packages/ansible
  executable location = /home/ops/test/venv-2.10/bin/ansible
  python version = 3.6.9 (default, Oct  8 2020, 12:12:24) [GCC 8.4.0]

OS / ENVIRONMENT

Host running ansible commands: Ubuntu 18.04.5 LTS

Vyos firewall:

Version:          VyOS 1.2.3
Built by:         Sentrium S.L.
Built on:         Thu 19 Sep 2019 21:09 UTC
Build UUID:       0fec8d46-3f04-41b0-b856-0695a2f50015
Build Commit ID:  24f1a74bc88f3a

Architecture:     x86_64
Boot via:         installed image
System type:      KVM guest

Hardware vendor:  Virtuozzo
Hardware model:   OpenStack Compute
Hardware S/N:     988eec22-2940-4d83-8b76-6b2418e64146
Hardware UUID:    988eec22-2940-4d83-8b76-6b2418e64146

Copyright:        VyOS maintainers and contributors
STEPS TO REPRODUCE

Inventory:

[vyos]
hel-fw-01              ansible_host=172.16.21.75

[vyos:vars]
ansible_user=vyos
ansible_connection=network_cli
ansible_network_os=vyos

Playbook:

- name: Firwall configuration, rules and aliases only
  hosts:
    - hel-fw-01
  gather_facts: true
  tasks:
    - name: Get running config from remote firewall
      vyos_facts:
        gather_subset: all
        gather_network_resources: all
      register: orig_vyos_config

Commands to reproduce:

python3 -m venv venv-2.10
python3 -m venv venv-2.9
. ./venv-2.9/bin/activate
pip install ansible==2.9 paramiko
ansible-playbook -i inventory test.yml
# NOTE: Succesful, see output below
. ./venv-2.10/bin/activate
pip install ansible==2.10 paramiko
ansible-playbook -i inventory test.yml
# Note: Failure, see output below
EXPECTED RESULTS
TASK [Get running config from remote firewall] *********************************************************************************************************************************
[WARNING]: default value for `gather_subset` will be changed to `min` from `!config` v2.11 onwards

ok: [hel-fw-01]
ACTUAL RESULTS

Verbose output using -v -v -v

TASK [Get running config from remote firewall] *********************************************************************************************************************************
task path: /home/ops/test/test.yml:6
redirecting (type: connection) ansible.builtin.network_cli to ansible.netcommon.network_cli
redirecting (type: terminal) ansible.builtin.vyos to vyos.vyos.vyos
redirecting (type: cliconf) ansible.builtin.vyos to vyos.vyos.vyos
redirecting (type: action) ansible.builtin.vyos to vyos.vyos.vyos
redirecting (type: action) ansible.builtin.vyos to vyos.vyos.vyos
<172.16.21.75> ESTABLISH LOCAL CONNECTION FOR USER: ops
<172.16.21.75> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/ops/.ansible/tmp/ansible-local-17007nwxg3giw `"&& mkdir "` echo /home/ops/.ansible/tmp/ansible-local-17007nwxg3giw/ansible-tmp-1606504658.6681817-17052-1823495894419 `" && echo ansible-tmp-1606504658.6681817-17052-1823495894419="` echo /home/ops/.ansible/tmp/ansible-local-17007nwxg3giw/ansible-tmp-1606504658.6681817-17052-1823495894419 `" ) && sleep 0'
redirecting (type: modules) ansible.builtin.vyos_facts to vyos.vyos.vyos_facts
Using module file /home/ops/.ansible/collections/ansible_collections/vyos/vyos/plugins/modules/vyos_facts.py
<172.16.21.75> PUT /home/ops/.ansible/tmp/ansible-local-17007nwxg3giw/tmpgafjez1p TO /home/ops/.ansible/tmp/ansible-local-17007nwxg3giw/ansible-tmp-1606504658.6681817-17052-1823495894419/AnsiballZ_vyos_facts.py
<172.16.21.75> EXEC /bin/sh -c 'chmod u+x /home/ops/.ansible/tmp/ansible-local-17007nwxg3giw/ansible-tmp-1606504658.6681817-17052-1823495894419/ /home/ops/.ansible/tmp/ansible-local-17007nwxg3giw/ansible-tmp-1606504658.6681817-17052-1823495894419/AnsiballZ_vyos_facts.py && sleep 0'
<172.16.21.75> EXEC /bin/sh -c '/usr/bin/python /home/ops/.ansible/tmp/ansible-local-17007nwxg3giw/ansible-tmp-1606504658.6681817-17052-1823495894419/AnsiballZ_vyos_facts.py && sleep 0'
<172.16.21.75> EXEC /bin/sh -c 'rm -f -r /home/ops/.ansible/tmp/ansible-local-17007nwxg3giw/ansible-tmp-1606504658.6681817-17052-1823495894419/ > /dev/null 2>&1 && sleep 0'
The full traceback is:
Traceback (most recent call last):
  File "/home/ops/.ansible/tmp/ansible-local-17007nwxg3giw/ansible-tmp-1606504658.6681817-17052-1823495894419/AnsiballZ_vyos_facts.py", line 102, in <module>
    _ansiballz_main()
  File "/home/ops/.ansible/tmp/ansible-local-17007nwxg3giw/ansible-tmp-1606504658.6681817-17052-1823495894419/AnsiballZ_vyos_facts.py", line 94, in _ansiballz_main
    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
  File "/home/ops/.ansible/tmp/ansible-local-17007nwxg3giw/ansible-tmp-1606504658.6681817-17052-1823495894419/AnsiballZ_vyos_facts.py", line 40, in invoke_module
    runpy.run_module(mod_name='ansible_collections.vyos.vyos.plugins.modules.vyos_facts', init_globals=None, run_name='__main__', alter_sys=True)
  File "/usr/lib/python2.7/runpy.py", line 188, in run_module
    fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 82, in _run_module_code
    mod_name, mod_fname, mod_loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/tmp/ansible_vyos_facts_payload_Ue7uxh/ansible_vyos_facts_payload.zip/ansible_collections/vyos/vyos/plugins/modules/vyos_facts.py", line 177, in <module>
  File "/tmp/ansible_vyos_facts_payload_Ue7uxh/ansible_vyos_facts_payload.zip/ansible_collections/vyos/vyos/plugins/modules/vyos_facts.py", line 168, in main
  File "/tmp/ansible_vyos_facts_payload_Ue7uxh/ansible_vyos_facts_payload.zip/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/facts/facts.py", line 97, in get_facts
  File "/tmp/ansible_vyos_facts_payload_Ue7uxh/ansible_vyos_facts_payload.zip/ansible_collections/ansible/netcommon/plugins/module_utils/network/common/facts/facts.py", line 131, in get_network_resources_facts
  File "/tmp/ansible_vyos_facts_payload_Ue7uxh/ansible_vyos_facts_payload.zip/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/facts/ospf_interfaces/ospf_interfaces.py", line 81, in populate_facts
  File "/tmp/ansible_vyos_facts_payload_Ue7uxh/ansible_vyos_facts_payload.zip/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/rm_templates/ospf_interfaces.py", line 308, in __init__
  File "/tmp/ansible_vyos_facts_payload_Ue7uxh/ansible_vyos_facts_payload.zip/ansible_collections/ansible/netcommon/plugins/module_utils/network/common/network_template.py", line 22, in __init__
  File "/tmp/ansible_vyos_facts_payload_Ue7uxh/ansible_vyos_facts_payload.zip/ansible_collections/ansible/netcommon/plugins/module_utils/network/common/utils.py", line 726, in __init__
ImportError: jinja2 is required but does not appear to be installed.  It can be installed using `pip install jinja2`
fatal: [hel-fw-01]: FAILED! => {
    "changed": false,
    "module_stderr": "Traceback (most recent call last):\n  File \"/home/ops/.ansible/tmp/ansible-local-17007nwxg3giw/ansible-tmp-1606504658.6681817-17052-1823495894419/AnsiballZ_vyos_facts.py\", line 102, in <module>\n    _ansiballz_main()\n  File \"/home/ops/.ansible/tmp/ansible-local-17007nwxg3giw/ansible-tmp-1606504658.6681817-17052-1823495894419/AnsiballZ_vyos_facts.py\", line 94, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n  File \"/home/ops/.ansible/tmp/ansible-local-17007nwxg3giw/ansible-tmp-1606504658.6681817-17052-1823495894419/AnsiballZ_vyos_facts.py\", line 40, in invoke_module\n    runpy.run_module(mod_name='ansible_collections.vyos.vyos.plugins.modules.vyos_facts', init_globals=None, run_name='__main__', alter_sys=True)\n  File \"/usr/lib/python2.7/runpy.py\", line 188, in run_module\n    fname, loader, pkg_name)\n  File \"/usr/lib/python2.7/runpy.py\", line 82, in _run_module_code\n    mod_name, mod_fname, mod_loader, pkg_name)\n  File \"/usr/lib/python2.7/runpy.py\", line 72, in _run_code\n    exec code in run_globals\n  File \"/tmp/ansible_vyos_facts_payload_Ue7uxh/ansible_vyos_facts_payload.zip/ansible_collections/vyos/vyos/plugins/modules/vyos_facts.py\", line 177, in <module>\n  File \"/tmp/ansible_vyos_facts_payload_Ue7uxh/ansible_vyos_facts_payload.zip/ansible_collections/vyos/vyos/plugins/modules/vyos_facts.py\", line 168, in main\n  File \"/tmp/ansible_vyos_facts_payload_Ue7uxh/ansible_vyos_facts_payload.zip/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/facts/facts.py\", line 97, in get_facts\n  File \"/tmp/ansible_vyos_facts_payload_Ue7uxh/ansible_vyos_facts_payload.zip/ansible_collections/ansible/netcommon/plugins/module_utils/network/common/facts/facts.py\", line 131, in get_network_resources_facts\n  File \"/tmp/ansible_vyos_facts_payload_Ue7uxh/ansible_vyos_facts_payload.zip/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/facts/ospf_interfaces/ospf_interfaces.py\", line 81, in populate_facts\n  File \"/tmp/ansible_vyos_facts_payload_Ue7uxh/ansible_vyos_facts_payload.zip/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/rm_templates/ospf_interfaces.py\", line 308, in __init__\n  File \"/tmp/ansible_vyos_facts_payload_Ue7uxh/ansible_vyos_facts_payload.zip/ansible_collections/ansible/netcommon/plugins/module_utils/network/common/network_template.py\", line 22, in __init__\n  File \"/tmp/ansible_vyos_facts_payload_Ue7uxh/ansible_vyos_facts_payload.zip/ansible_collections/ansible/netcommon/plugins/module_utils/network/common/utils.py\", line 726, in __init__\nImportError: jinja2 is required but does not appear to be installed.  It can be installed using `pip install jinja2`\n",
    "module_stdout": "",
    "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
    "rc": 1
}

Firewall global port-groups are not added

SUMMARY

Adding port groups are not handled.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

plugins/module_utils/network/vyos/config/firewall_global/firewall_global.py

ANSIBLE VERSION
ansible 2.9.14
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.5 (default, Apr  2 2020, 13:16:51) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]

I deleted the rest, because a PR is incoming. This is due to a typo when a - was used instead of an underscore.

diff --git a/plugins/module_utils/network/vyos/config/firewall_global/firewall_global.py b/plugins/module_utils/network/vyos/config/firewall_global/firewall_global.py
index 08b724a..3d61df7 100644
--- a/plugins/module_utils/network/vyos/config/firewall_global/firewall_global.py
+++ b/plugins/module_utils/network/vyos/config/firewall_global/firewall_global.py
@@ -349,7 +349,7 @@ class Firewall_global(ConfigBase):
                 h_grp = h.get("group") or {}
             if w:
                 commands.extend(
-                    self._render_grp_mem("port-group", w["group"], h_grp, opr)
+                    self._render_grp_mem("port_group", w["group"], h_grp, opr)
                 )
                 commands.extend(
                     self._render_grp_mem(

Support configuring area interfaces for OSPFv3

SUMMARY

Add support for OSPFv3 area interface configuration.

ISSUE TYPE
  • Feature Idea
COMPONENT NAME

vyos.vyos.vyos_ospfv3

ADDITIONAL INFORMATION

Task:

- vyos.vyos.vyos_ospfv3:
    config:
      areas:
        - area_id: "0"
          interfaces:
            - eth0
            - lo
    state: present

Desired config:

[edit protocols ospfv3]
vyos@BH-NET-FR01# show
 area 0 {
     interface eth0
     interface lo
 }

[facts] change `gather_subset` default to `min`

SUMMARY

The default for gather_subset was supposed to be changed to min from !config starting from ansible 2.11. This change hasn't been implemented yet.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

vyos_facts.py

vyos_firewall_rules doesn't appear to be stable

SUMMARY

It seems like we have a race condition for vyos_firewall_rules. We need to properly fix.

https://object-storage-ca-ymq-1.vexxhost.net/v1/a0b4156a37f9453eb4ec7db5422272df/ansible_10/10/2fa14b5c9958b8c2d755614ca729aded68e1b348/check/ansible-test-network-integration-vyos-python27/b7a4072/controller/ara-report/

ISSUE TYPE
  • Bug Report
COMPONENT NAME
ANSIBLE VERSION

CONFIGURATION

OS / ENVIRONMENT
STEPS TO REPRODUCE
EXPECTED RESULTS
ACTUAL RESULTS

Add available_network_resources key in vyos_facts module

  • The key will return the list of all the RM resources available for the platform.
  • This implementation doesn't affect the current functionality of the vyos_facts module and users can use the vyos_facts module in the same way as they were before.

Current behavior:

---
- name: Fatch facts
  hosts: vyos
  gather_facts: no
  collections:
    - vyos.vyos
  
  tasks:
    - name: Get basic facts 
      vyos_facts:
        gather_subset:
          - '!all'

output

ok: [192.168.6.120] => {
    "ansible_facts": {
        "ansible_net_api": "cliconf",
        "ansible_net_gather_network_resources": [],
        "ansible_net_gather_subset": [
            "default"
        ],
        "ansible_net_hostname": "vyos",
        "ansible_net_model": "VirtualBox",
        "ansible_net_python_version": "3.9.2",
        "ansible_net_serialnum": "0",
        "ansible_net_system": "vyos",
        "ansible_net_version": "VyOS 1.1.8",
        "ansible_network_resources": {},
        "discovered_interpreter_python": "/usr/bin/python"
    },
    "changed": false,
    "invocation": {
        "module_args": {
            "gather_network_resources": null,
            "gather_subset": [
                "!all"
            ],
            "provider": null
        }
    }
}

After implementation of available_network_resources
Sample Playbook:

---
- name: Get the list of  available resource Modules
  hosts: vyos
  gather_facts: no
  collections:
    - vyos.vyos
  
  tasks:
    - name: Get the list of avaliable network resources for VyOS and avoid fetching resource facts
      junos_facts:
        gather_subset:
          - '!all'
        available_network_resources: true

Result:

ok: [192.168.56.120] => {
    "ansible_facts": {
        "ansible_net_api": "cliconf",
        "ansible_net_gather_network_resources": [],
        "ansible_net_gather_subset": [
            "default"
        ],
        "ansible_net_hostname": "vyos",
        "ansible_net_model": "VirtualBox",
        "ansible_net_python_version": "3.9.2",
        "ansible_net_serialnum": "0",
        "ansible_net_system": "vyos",
        "ansible_net_version": "VyOS 1.1.8",
        "ansible_network_resources": {},
        "available_network_resources": [
            "bgp_address_family",
            "bgp_global",
            "firewall_global",
            "firewall_interfaces",
            "firewall_rules",
            "interfaces",
            "l3_interfaces",
            "lag_interfaces",
            "lldp_global",
            "lldp_interfaces",
            "ospf_interfaces",
            "ospfv2",
            "ospfv3",
            "static_routes"
        ],
        "discovered_interpreter_python": "/usr/bin/python"
    },
    "changed": false,
    "invocation": {
        "module_args": {
            "available_network_resources": true,
            "gather_network_resources": null,
            "gather_subset": [
                "!all"
            ],
            "provider": null
        }
    }
}

[vyos_config] unable to update encrypted-password

SUMMARY

Trying to set the encrypted-password key does not work when using vyos_config, because of a filter on the commands to run on the target here.
I would like to be able to set the encrypted-password to be the same on all of my devices, without having to deal cleartext passwords in my ansible output diff.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

vyos_config

ANSIBLE VERSION
ansible [core 2.11.2]
COLLECTION VERSION
Collection Version
---------- -------
vyos.vyos  2.3.0
OS / ENVIRONMENT
STEPS TO REPRODUCE
- name: render a Jinja2 template onto the VyOS router
  vyos.vyos.vyos_config:
    lines: set system login user lucaelin authentication encrypted-password '$6$saltysalt$OvwDpjWdBeANXS5VmgbxQEy9DOywsFLAZa.bBULLVgy8TFyKJBmewy0nMg5D70MysS8un40UH1DmCSf6haSMl/'
  register: output

- debug:
    var: output
EXPECTED RESULTS

The password-hash should be set on the device

ACTUAL RESULTS

The command is filtered

TASK [vyos : render a Jinja2 template onto the VyOS router] ****************************************

ok: [vyos.box]

TASK [vyos : debug] ********************************************************************************
ok: [vyos.box] => {
    "output": {
        "changed": false,
        "commands": [],
        "diff": {
            "prepared": null
        },
        "failed": false,
        "filtered": [
            "set system login user lucaelin authentication encrypted-password '$6$saltysalt$OvwDpjWdBeANX
S5VmgbxQEy9DOywsFLAZa.bBULLVgy8TFyKJBmewy0nMg5D70MysS8un40UH1DmCSf6haSMl/'"
        ]
    }
}

Fact discovery has trailing \u001b[m after each line/value

SUMMARY

This looks similar to #65. I'm getting \u001b[m after every line or value when running vyos.vyos.vyos_facts, and this appears to break other things as well (I first came across this with an error when running vyos.vyos.vyos_firewall_rules and then proceeded to find a smaller test case to reproduce it with).

For example:

        ...
        "net_commits": [
            {
                "by": "ansible",
                "comment": null,
                "datetime": "2021-03-20 04:05:32 ",
                "revision": "0",
                "via": "cli\u001b[m"
            },
           ...
ISSUE TYPE
  • Bug Report
COMPONENT NAME

vyos.vyos.vyos_facts

ANSIBLE VERSION
ansible 2.9.6
  config file = /home/sdwilsh/ansible-playbooks/ansible.cfg
  configured module search path = ['/home/sdwilsh/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3/dist-packages/ansible
  executable location = /usr/bin/ansible
  python version = 3.8.5 (default, Jan 27 2021, 15:41:15) [GCC 9.3.0]
CONFIGURATION
DEFAULT_VAULT_PASSWORD_FILE(/home/sdwilsh/ansible-playbooks/ansible.cfg) = /home/sdwilsh/ansible-playbooks/.ansible_vault_password
INTERPRETER_PYTHON(/home/sdwilsh/ansible-playbooks/ansible.cfg) = auto
OS / ENVIRONMENT

Custom built vyos roughly equivalent to 1.3.0 RC1 (Build Commit ID: 3be456b18cf3ae)

STEPS TO REPRODUCE

ansible-playbook -i testing-inventory -l maccabeus.hogs.tswn.us get_facts.yml -u ansible -vvvv

---
- name: Get ansible facts
  hosts: vyos
  tasks:
    - vyos.vyos.vyos_facts:
        gather_subset: all
    - debug:
        msg: "The hostname is {{ ansible_net_hostname }} and the OS is {{ ansible_net_version }}"
EXPECTED RESULTS
    "msg": "The hostname is maccabeus.hogs.tswn.us and the OS is VyOS 1.3.0-rc1"
ACTUAL RESULTS
ansible-playbook 2.9.6
  config file = /home/sdwilsh/ansible-playbooks/ansible.cfg
  configured module search path = ['/home/sdwilsh/.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.8.5 (default, Jan 27 2021, 15:41:15) [GCC 9.3.0]
Using /home/sdwilsh/ansible-playbooks/ansible.cfg as config file
setting up inventory plugins
host_list declined parsing /home/sdwilsh/ansible-playbooks/testing-inventory as it did not pass its verify_file() method
script declined parsing /home/sdwilsh/ansible-playbooks/testing-inventory as it did not pass its verify_file() method
auto declined parsing /home/sdwilsh/ansible-playbooks/testing-inventory as it did not pass its verify_file() method
Parsed /home/sdwilsh/ansible-playbooks/testing-inventory inventory source with ini plugin
Loading callback plugin default of type stdout, v2.0 from /usr/lib/python3/dist-packages/ansible/plugins/callback/default.py

PLAYBOOK: get_facts.yml ***************************************************************************************************************************************************************************************
Positional arguments: get_facts.yml
verbosity: 4
remote_user: ansible
connection: smart
timeout: 10
become_method: sudo
tags: ('all',)
inventory: ('/home/sdwilsh/ansible-playbooks/testing-inventory',)
subset: maccabeus.hogs.tswn.us
forks: 5
1 plays in get_facts.yml

PLAY [Get ansible facts] **************************************************************************************************************************************************************************************

TASK [Gathering Facts] ****************************************************************************************************************************************************************************************
task path: /home/sdwilsh/ansible-playbooks/get_facts.yml:2
<10.10.0.1> attempting to start connection
<10.10.0.1> using connection plugin network_cli
<10.10.0.1> local domain socket does not exist, starting it
<10.10.0.1> control socket path is /home/sdwilsh/.ansible/pc/79828898f7
<10.10.0.1> local domain socket listeners started successfully
<10.10.0.1> loaded cliconf plugin vyos from path /usr/lib/python3/dist-packages/ansible/plugins/cliconf/vyos.py for network_os vyos
<10.10.0.1> 
<10.10.0.1> local domain socket path is /home/sdwilsh/.ansible/pc/79828898f7
<10.10.0.1> ESTABLISH LOCAL CONNECTION FOR USER: sdwilsh
<10.10.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/sdwilsh/.ansible/tmp/ansible-local-268907f4_1n_d8/ansible-tmp-1616219810.1474397-58028577226599 `" && echo ansible-tmp-1616219810.1474397-58028577226599="` echo /home/sdwilsh/.ansible/tmp/ansible-local-268907f4_1n_d8/ansible-tmp-1616219810.1474397-58028577226599 `" ) && sleep 0'
<maccabeus.hogs.tswn.us> Attempting python interpreter discovery
<10.10.0.1> EXEC /bin/sh -c 'echo PLATFORM; uname; echo FOUND; command -v '"'"'/usr/bin/python'"'"'; 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'
<10.10.0.1> EXEC /bin/sh -c '/usr/bin/python3 && sleep 0'
Using module file /usr/lib/python3/dist-packages/ansible/modules/network/vyos/vyos_facts.py
<10.10.0.1> PUT /home/sdwilsh/.ansible/tmp/ansible-local-268907f4_1n_d8/tmp73nsdxur TO /home/sdwilsh/.ansible/tmp/ansible-local-268907f4_1n_d8/ansible-tmp-1616219810.1474397-58028577226599/AnsiballZ_vyos_facts.py
<10.10.0.1> EXEC /bin/sh -c 'chmod u+x /home/sdwilsh/.ansible/tmp/ansible-local-268907f4_1n_d8/ansible-tmp-1616219810.1474397-58028577226599/ /home/sdwilsh/.ansible/tmp/ansible-local-268907f4_1n_d8/ansible-tmp-1616219810.1474397-58028577226599/AnsiballZ_vyos_facts.py && sleep 0'
<10.10.0.1> EXEC /bin/sh -c '/usr/bin/python3 /home/sdwilsh/.ansible/tmp/ansible-local-268907f4_1n_d8/ansible-tmp-1616219810.1474397-58028577226599/AnsiballZ_vyos_facts.py && sleep 0'
<10.10.0.1> EXEC /bin/sh -c 'rm -f -r /home/sdwilsh/.ansible/tmp/ansible-local-268907f4_1n_d8/ansible-tmp-1616219810.1474397-58028577226599/ > /dev/null 2>&1 && sleep 0'
ok: [maccabeus.hogs.tswn.us]
META: ran handlers

TASK [vyos.vyos.vyos_facts] ***********************************************************************************************************************************************************************************
task path: /home/sdwilsh/ansible-playbooks/get_facts.yml:5
<10.10.0.1> attempting to start connection
<10.10.0.1> using connection plugin network_cli
<10.10.0.1> found existing local domain socket, using it!
<10.10.0.1> ssh connection done, setting terminal
<10.10.0.1> loaded terminal plugin for network_os vyos
<10.10.0.1> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<10.10.0.1> firing event: on_open_shell()
<10.10.0.1> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<10.10.0.1> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<10.10.0.1> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<10.10.0.1> ssh connection has completed successfully
<10.10.0.1> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<10.10.0.1> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<10.10.0.1> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<10.10.0.1> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<10.10.0.1> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<10.10.0.1> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<10.10.0.1> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<10.10.0.1> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<10.10.0.1> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<10.10.0.1> updating play_context for connection
<10.10.0.1> 
<10.10.0.1> local domain socket path is /home/sdwilsh/.ansible/pc/79828898f7
<10.10.0.1> ESTABLISH LOCAL CONNECTION FOR USER: sdwilsh
<10.10.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/sdwilsh/.ansible/tmp/ansible-local-268907f4_1n_d8/ansible-tmp-1616219814.6760836-125456008838287 `" && echo ansible-tmp-1616219814.6760836-125456008838287="` echo /home/sdwilsh/.ansible/tmp/ansible-local-268907f4_1n_d8/ansible-tmp-1616219814.6760836-125456008838287 `" ) && sleep 0'
Using module file /home/sdwilsh/.ansible/collections/ansible_collections/vyos/vyos/plugins/modules/vyos_facts.py
<10.10.0.1> PUT /home/sdwilsh/.ansible/tmp/ansible-local-268907f4_1n_d8/tmptmcr0blm TO /home/sdwilsh/.ansible/tmp/ansible-local-268907f4_1n_d8/ansible-tmp-1616219814.6760836-125456008838287/AnsiballZ_vyos_facts.py
<10.10.0.1> EXEC /bin/sh -c 'chmod u+x /home/sdwilsh/.ansible/tmp/ansible-local-268907f4_1n_d8/ansible-tmp-1616219814.6760836-125456008838287/ /home/sdwilsh/.ansible/tmp/ansible-local-268907f4_1n_d8/ansible-tmp-1616219814.6760836-125456008838287/AnsiballZ_vyos_facts.py && sleep 0'
<10.10.0.1> EXEC /bin/sh -c '/usr/bin/python3 /home/sdwilsh/.ansible/tmp/ansible-local-268907f4_1n_d8/ansible-tmp-1616219814.6760836-125456008838287/AnsiballZ_vyos_facts.py && sleep 0'
<10.10.0.1> EXEC /bin/sh -c 'rm -f -r /home/sdwilsh/.ansible/tmp/ansible-local-268907f4_1n_d8/ansible-tmp-1616219814.6760836-125456008838287/ > /dev/null 2>&1 && sleep 0'
ok: [maccabeus.hogs.tswn.us] => {
    "ansible_facts": {
        "ansible_net_api": "cliconf",
        "ansible_net_commits": [
            {
                "by": "ansible",
                "comment": null,
                "datetime": "2021-03-20 04:05:32 ",
                "revision": "0",
                "via": "cli\u001b[m"
            },
            {
                "by": "ansible",
                "comment": null,
                "datetime": "2021-03-20 04:05:30 ",
                "revision": "1",
                "via": "cli\u001b[m"
            },
            {
                "by": "ansible",
                "comment": null,
                "datetime": "2021-03-20 03:58:32 ",
                "revision": "2",
                "via": "cli\u001b[m"
            },
            {
                "by": "vyos",
                "comment": null,
                "datetime": "2021-03-20 03:50:30 ",
                "revision": "3",
                "via": "cli\u001b[m"
            },
            {
                "by": "vyos",
                "comment": null,
                "datetime": "2021-03-20 03:47:25 ",
                "revision": "4",
                "via": "cli\u001b[m"
            },
            {
                "by": "vyos",
                "comment": null,
                "datetime": "2021-03-20 03:22:49 ",
                "revision": "5",
                "via": "cli\u001b[m"
            },
            {
                "by": "vyos",
                "comment": null,
                "datetime": "2021-03-20 03:20:59 ",
                "revision": "6",
                "via": "cli\u001b[m"
            },
            {
                "by": "vyos",
                "comment": null,
                "datetime": "2021-03-19 04:26:31 ",
                "revision": "7",
                "via": "cli\u001b[m"
            },
            {
                "by": "vyos",
                "comment": null,
                "datetime": "2021-03-19 04:18:34 ",
                "revision": "8",
                "via": "cli\u001b[m"
            },
            {
                "by": "vyos",
                "comment": null,
                "datetime": "2021-03-19 03:37:57 ",
                "revision": "9",
                "via": "cli\u001b[m"
            },
            {
                "by": "vyos",
                "comment": null,
                "datetime": "2021-03-19 03:31:44 ",
                "revision": "10",
                "via": "cli\u001b[m"
            },
            {
                "by": "vyos",
                "comment": null,
                "datetime": "2021-03-19 01:18:57 ",
                "revision": "11",
                "via": "cli\u001b[m"
            },
            {
                "by": "vyos",
                "comment": null,
                "datetime": "2021-03-19 01:06:16 ",
                "revision": "12",
                "via": "cli\u001b[m"
            },
            {
                "by": "vyos",
                "comment": null,
                "datetime": "2021-03-19 01:04:11 ",
                "revision": "13",
                "via": "cli\u001b[m"
            },
            {
                "by": "root",
                "comment": null,
                "datetime": "2021-03-19 00:59:37 ",
                "revision": "14",
                "via": "vyos-boot-config-loader\u001b[m"
            }
        ],
        "ansible_net_config": [
            "set firewall all-ping 'enable'\u001b[m\nset firewall broadcast-ping 'disable'\u001b[m\nset firewall config-trap 'disable'\u001b[m\nset firewall ipv6-receive-redirects 'disable'\u001b[m\nset firewall ipv6-src-route 'disable'\u001b[m\nset firewall ip-src-route 'disable'\u001b[m\nset firewall log-martians 'enable'\u001b[m\nset firewall name WAN-local default-action 'drop'\u001b[m\nset firewall name WAN-local rule 1 action 'accept'\u001b[m\nset firewall name WAN-local rule 1 state established 'enable'\u001b[m\nset firewall name WAN-local rule 1 state related 'enable'\u001b[m\nset firewall name WAN-local rule 2 action 'drop'\u001b[m\nset firewall name WAN-local rule 2 state invalid 'enable'\u001b[m\nset firewall name local-WAN default-action 'accept'\u001b[m\nset firewall receive-redirects 'disable'\u001b[m\nset firewall send-redirects 'enable'\u001b[m\nset firewall source-validation 'disable'\u001b[m\nset firewall syn-cookies 'enable'\u001b[m\nset firewall twa-hazards-protection 'disable'\u001b[m\nset interfaces ethernet eth0 hw-id '00:15:5d:01:c2:05'\u001b[m\nset interfaces ethernet eth0 vif 10 firewall in name 'local-WAN'\u001b[m\nset interfaces ethernet eth0 vif 10 firewall local name 'local-WAN'\u001b[m\nset interfaces ethernet eth0 vif 10 firewall out name 'local-WAN'\u001b[m\nset interfaces ethernet eth0 vif 201 description 'CenturyLink PPPoE'\u001b[m\nset interfaces ethernet eth1 hw-id '00:15:5d:01:c2:06'\u001b[m\nset interfaces ethernet eth1 vif 10 address '10.10.0.1/24'\u001b[m\nset interfaces loopback lo\u001b[m\nset interfaces pppoe pppoe0 authentication password 'vyos'\u001b[m\nset interfaces pppoe pppoe0 authentication user 'vyos'\u001b[m\nset interfaces pppoe pppoe0 default-route 'auto'\u001b[m\nset interfaces pppoe pppoe0 firewall in name 'local-WAN'\u001b[m\nset interfaces pppoe pppoe0 firewall local name 'local-WAN'\u001b[m\nset interfaces pppoe pppoe0 firewall out name 'local-WAN'\u001b[m\nset interfaces pppoe pppoe0 mtu '1492'\u001b[m\nset interfaces pppoe pppoe0 source-interface 'eth0.201'\u001b[m\nset service dhcp-server shared-network-name MAN authoritative\u001b[m\nset service dhcp-server shared-network-name MAN subnet 10.10.0.0/24 default-router '10.10.0.1'\u001b[m\nset service dhcp-server shared-network-name MAN subnet 10.10.0.0/24 range 0 start '10.10.0.200'\u001b[m\nset service dhcp-server shared-network-name MAN subnet 10.10.0.0/24 range 0 stop '10.10.0.250'\u001b[m\nset service ssh listen-address '10.10.0.1'\u001b[m\nset system config-management commit-revisions '100'\u001b[m\nset system console device ttyS0 speed '115200'\u001b[m\nset system domain-search domain 'hogs.tswn.us'\u001b[m\nset system host-name 'maccabeus.hogs.tswn.us'\u001b[m\nset system login user ansible authentication public-keys ansbile@sdwilsh-dev key 'AAAAC3NzaC1lZDI1NTE5AAAAIMiRn+dJyIkJ22qrkuMlNC33xxS7VUwkYRY/55Wf4ryq'\u001b[m\nset system login user ansible authentication public-keys ansbile@sdwilsh-dev type 'ssh-ed25519'\u001b[m\nset system login user ansible full-name 'ansible'\u001b[m\nset system login user vyos authentication encrypted-password '$6$GoYinRgTWrilPn$NNGRoUpms08mgTXAx3LxQG4TOh7462VdxuC9SIBjNYdlJ2lpjwZc5eplhGIfEu668r9ACZ4Y5LSXwWpgq8hFG/'\u001b[m\nset system login user vyos authentication plaintext-password ''\u001b[m\nset system name-server '10.117.0.3'\u001b[m\nset system name-server '10.117.0.4'\u001b[m\nset system name-server 'fd36:3eb3:43b0:75::3'\u001b[m\nset system name-server 'fd36:3eb3:43b0:75::4'\u001b[m\nset system ntp server 0.pool.ntp.org\u001b[m\nset system ntp server 1.pool.ntp.org\u001b[m\nset system ntp server 2.pool.ntp.org\u001b[m\nset system syslog global facility all level 'info'\u001b[m\nset system syslog global facility protocols level 'debug'\u001b[m",
            "0   2021-03-20 04:05:32 by ansible via cli\u001b[m\n1   2021-03-20 04:05:30 by ansible via cli\u001b[m\n2   2021-03-20 03:58:32 by ansible via cli\u001b[m\n3   2021-03-20 03:50:30 by vyos via cli\u001b[m\n4   2021-03-20 03:47:25 by vyos via cli\u001b[m\n5   2021-03-20 03:22:49 by vyos via cli\u001b[m\n6   2021-03-20 03:20:59 by vyos via cli\u001b[m\n7   2021-03-19 04:26:31 by vyos via cli\u001b[m\n8   2021-03-19 04:18:34 by vyos via cli\u001b[m\n9   2021-03-19 03:37:57 by vyos via cli\u001b[m\n10  2021-03-19 03:31:44 by vyos via cli\u001b[m\n11  2021-03-19 01:18:57 by vyos via cli\u001b[m\n12  2021-03-19 01:06:16 by vyos via cli\u001b[m\n13  2021-03-19 01:04:11 by vyos via cli\u001b[m\n14  2021-03-19 00:59:37 by root via vyos-boot-config-loader\u001b[m\n15  2021-03-19 00:59:36 by root via init\u001b[m"
        ],
        "ansible_net_gather_network_resources": [],
        "ansible_net_gather_subset": [
            "config",
            "neighbors",
            "default"
        ],
        "ansible_net_hostname": "maccabeus.hogs.tswn.us\u001b[m",
        "ansible_net_neighbors": {},
        "ansible_net_python_version": "3.8.5",
        "ansible_net_serialnum": null,
        "ansible_net_system": "vyos",
        "ansible_net_version": "VyOS 1.3.0-rc1\u001b[m",
        "ansible_network_resources": {}
    },
    "changed": false,
    "invocation": {
        "module_args": {
            "gather_network_resources": null,
            "gather_subset": [
                "all"
            ],
            "provider": null
        }
    }
}

TASK [debug] **************************************************************************************************************************************************************************************************
task path: /home/sdwilsh/ansible-playbooks/get_facts.yml:7
<10.10.0.1> attempting to start connection
<10.10.0.1> using connection plugin network_cli
<10.10.0.1> found existing local domain socket, using it!
<10.10.0.1> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<10.10.0.1> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<10.10.0.1> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<10.10.0.1> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<10.10.0.1> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<10.10.0.1> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<10.10.0.1> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<10.10.0.1> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<10.10.0.1> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<10.10.0.1> updating play_context for connection
<10.10.0.1> 
<10.10.0.1> local domain socket path is /home/sdwilsh/.ansible/pc/79828898f7
ok: [maccabeus.hogs.tswn.us] => {
    "msg": "The hostname is maccabeus.hogs.tswn.us\u001b[m and the OS is VyOS 1.3.0-rc1\u001b[m"
}
META: ran handlers
META: ran handlers

PLAY RECAP ****************************************************************************************************************************************************************************************************
maccabeus.hogs.tswn.us     : ok=3    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   

Fact discovery has trailing \e[m after each line/value

SUMMARY

Discoveryed facts have a trailing \e[m after values and or lines
for example

    ansible_net_hostname: "vyos\e[m"
    ansible_net_version: "VyOS 1.3-rolling-202007130117\e[m"
    ansible_net_config:
    - |-
      set interfaces ethernet eth0 address 'dhcp'[m
      set interfaces ethernet eth0 hw-id '08:00:27:cf:54:d5'[m
      set interfaces ethernet eth1 hw-id '08:00:27:7b:6e:55'[m
      set interfaces ethernet eth2 hw-id '08:00:27:8a:84:fe'[m
...
ISSUE TYPE
  • Bug Report
COMPONENT NAME
  vyos.vyos.vyos_facts
ANSIBLE VERSION
ansible 2.9.10
  config file = /home/foobar/git/devops/ansible.cfg
  configured module search path = ['/home/foobar/git/devops/lib/ansible/modules']
  ansible python module location = /home/foobar/ansible/lib/python3.7/site-packages/ansible
  executable location = /home/foobar/bin/ansible
  python version = 3.7.3 (default, Dec 20 2019, 18:57:59) [GCC 8.3.0]

CONFIGURATION
ANSIBLE_NOCOLOR(/home/foobar/git/devops/ansible.cfg) = False
ANSIBLE_NOCOWS(/home/foobar/git/devops/ansible.cfg) = True
ANSIBLE_PIPELINING(/home/foobar/git/devops/ansible.cfg) = True
ANSIBLE_SSH_ARGS(/home/foobar/git/devops/ansible.cfg) = -o PasswordAuthentication=no -o ControlMaster=auto -o ControlPersist=600s
COMMAND_WARNINGS(/home/foobar/git/devops/ansible.cfg) = True
DEFAULT_ACTION_PLUGIN_PATH(/home/foobar/git/devops/ansible.cfg) = ['/home/foobar/git/devops/lib/ansible/plugins/action']
DEFAULT_BECOME_USER(/home/foobar/git/devops/ansible.cfg) = root
DEFAULT_CACHE_PLUGIN_PATH(/home/foobar/git/devops/ansible.cfg) = ['/home/foobar/git/devops/lib/ansible/plugins/cache']
DEFAULT_CALLBACK_PLUGIN_PATH(/home/foobar/git/devops/ansible.cfg) = ['/home/foobar/git/devops/lib/ansible/plugins/callback']
DEFAULT_CONNECTION_PLUGIN_PATH(/home/foobar/git/devops/ansible.cfg) = ['/home/foobar/git/devops/lib/ansible/plugins/connection']
DEFAULT_FILTER_PLUGIN_PATH(/home/foobar/git/devops/ansible.cfg) = ['/home/foobar/git/devops/lib/ansible/plugins/filter']
DEFAULT_FORCE_HANDLERS(/home/foobar/git/devops/ansible.cfg) = True
DEFAULT_FORKS(/home/foobar/git/devops/ansible.cfg) = 5
DEFAULT_GATHERING(/home/foobar/git/devops/ansible.cfg) = smart
DEFAULT_GATHER_SUBSET(/home/foobar/git/devops/ansible.cfg) = ['all', '!ohai']
DEFAULT_HOST_LIST(/home/foobar/git/devops/ansible.cfg) = ['/home/foobar/git/devops/ansible/vagrant/inventory']
DEFAULT_LOG_PATH(/home/foobar/git/devops/ansible.cfg) = /home/foobar/git/devops/ansible/vagrant/ansible.log
DEFAULT_LOOKUP_PLUGIN_PATH(/home/foobar/git/devops/ansible.cfg) = ['/home/foobar/git/devops/lib/ansible/plugins/lookup']
DEFAULT_MANAGED_STR(/home/foobar/git/devops/ansible.cfg) = Ansible managed file {file} modified on %Y-%m-%d %H:%M:%S by {uid} on {host}
DEFAULT_MODULE_NAME(/home/foobar/git/devops/ansible.cfg) = command
DEFAULT_MODULE_PATH(/home/foobar/git/devops/ansible.cfg) = ['/home/foobar/git/devops/lib/ansible/modules']
DEFAULT_POLL_INTERVAL(/home/foobar/git/devops/ansible.cfg) = 15
DEFAULT_ROLES_PATH(/home/foobar/git/devops/ansible.cfg) = ['/home/foobar/git/devops/roles']
DEFAULT_SCP_IF_SSH(/home/foobar/git/devops/ansible.cfg) = True
DEFAULT_STDOUT_CALLBACK(/home/foobar/git/devops/ansible.cfg) = yaml
DEFAULT_STRATEGY_PLUGIN_PATH(/home/foobar/git/devops/ansible.cfg) = ['/home/foobar/git/devops/lib/ansible/plugins/strategy']
DEFAULT_TEST_PLUGIN_PATH(/home/foobar/git/devops/ansible.cfg) = ['/home/foobar/git/devops/lib/ansible/plugins/test']
DEFAULT_TIMEOUT(/home/foobar/git/devops/ansible.cfg) = 10
DEFAULT_VARS_PLUGIN_PATH(/home/foobar/git/devops/ansible.cfg) = ['/home/foobar/git/devops/lib/ansible/plugins/vars']
DEPRECATION_WARNINGS(/home/foobar/git/devops/ansible.cfg) = True
DISPLAY_SKIPPED_HOSTS(/home/foobar/git/devops/ansible.cfg) = True
HOST_KEY_CHECKING(/home/foobar/git/devops/ansible.cfg) = False

OS / ENVIRONMENT

vyos 1.3-rolling-202007130117

STEPS TO REPRODUCE

ansible-playbook -vv -CD playbooks/boxes/vyos.yml

---
- name: vyos setup
  connection: network_cli
  gather_facts: false
  hosts: os.vyos
  vars:
    ansible_network_os: vyos
  tasks:

    - name: Get config for VyOS devices
      vyos.vyos.vyos_facts:
        gather_subset: all
        # gather_network_resources: all

    - name: Display the config
      debug:
        msg: The hostname is {{ ansible_net_hostname }} and the OS is {{ ansible_net_version }}
EXPECTED RESULTS
  msg: "The hostname is vyos and the OS is VyOS 1.3-rolling-202007130117"
ACTUAL RESULTS

What the result i got in the debug print was:

ok: [router] => 
  msg: "The hostname is vyos\e[m and the OS is VyOS 1.3-rolling-202007130117\e[m"
ansible-playbook 2.9.10
  config file = /home/foobar/git/devops/ansible/vagrant/ansible.cfg
  configured module search path = ['/home/foobar/git/devops/lib/ansible/modules']
  ansible python module location = /home/foobar/ansible/lib/python3.7/site-packages/ansible
  executable location = /home/foobar/bin/ansible-playbook
  python version = 3.7.3 (default, Dec 20 2019, 18:57:59) [GCC 8.3.0]
Using /home/foobar/git/devops/ansible/vagrant/ansible.cfg as config file
setting up inventory plugins
host_list declined parsing /home/foobar/git/devops/ansible/vagrant/inventory as it did not pass its verify_file() method
script declined parsing /home/foobar/git/devops/ansible/vagrant/inventory as it did not pass its verify_file() method
auto declined parsing /home/foobar/git/devops/ansible/vagrant/inventory as it did not pass its verify_file() method

Parsed /home/foobar/git/devops/ansible/vagrant/inventory inventory source with ini plugin
Loading callback plugin yaml of type stdout, v2.0 from /home/foobar/ansible/lib/python3.7/site-packages/ansible/plugins/callback/yaml.py

PLAYBOOK: vyos.yml *******************************************************************************************************************
Positional arguments: playbooks/boxes/vyos.yml
verbosity: 4
connection: smart
timeout: 10
force_handlers: True
become_method: sudo
tags: ('all',)
check: True
diff: True
inventory: ('/home/foobar/git/devops/ansible/vagrant/inventory',)
forks: 5
1 plays in playbooks/boxes/vyos.yml

PLAY [Network Getting Started First Playbook] ****************************************************************************************
META: ran handlers

TASK [Get config for VyOS devices] ***************************************************************************************************
task path: /home/foobar/git/devops/ansible/vagrant/playbooks/boxes/vyos.yml:10
<router.test> attempting to start connection
<router.test> using connection plugin network_cli
<router.test> local domain socket does not exist, starting it
<router.test> control socket path is /home/foobar/.ansible/pc/98284ff3ed
<router.test> local domain socket listeners started successfully
<router.test> loaded cliconf plugin vyos from path /home/foobar/ansible/lib/python3.7/site-packages/ansible/plugins/cliconf/vyos.py for network_os vyos
<router.test> 
<router.test> local domain socket path is /home/foobar/.ansible/pc/98284ff3ed
<router> Attempting python interpreter discovery
<router.test> ESTABLISH LOCAL CONNECTION FOR USER: foobar
<router.test> EXEC /bin/sh -c 'echo PLATFORM; uname; echo FOUND; command -v '"'"'/usr/bin/python'"'"'; 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'
<router.test> EXEC /bin/sh -c '/usr/bin/python && sleep 0'
<router> Python interpreter discovery fallback (unsupported Linux distribution: LinuxMint)
Using module file /home/foobar/.ansible/collections/ansible_collections/vyos/vyos/plugins/modules/vyos_facts.py
Pipelining is enabled.
<router.test> EXEC /bin/sh -c '/usr/bin/python && sleep 0'
[WARNING]: Platform linux on host router is using the discovered Python interpreter at /usr/bin/python, but future installation of
another Python interpreter could change this. See
https://docs.ansible.com/ansible/2.9/reference_appendices/interpreter_discovery.html for more information.
ok: [router] => changed=false 
  ansible_facts:
    ansible_net_api: cliconf
    ansible_net_commits:
    - by: vagrant
      comment: null
      datetime: '2020-07-13 11:38:45 '
      revision: '0'
      via: "cli\e[m"
    - by: vagrant
      comment: null
      datetime: '2020-07-13 11:36:01 '
      revision: '1'
      via: "cli\e[m"
    - by: vagrant
      comment: null
      datetime: '2020-07-13 11:34:33 '
      revision: '2'
      via: "cli\e[m"
    - by: root
      comment: null
      datetime: '2020-07-13 11:29:15 '
      revision: '3'
      via: "vyos-boot-config-loader\e[m"
    - by: vagrant
      comment: null
      datetime: '2020-07-13 09:28:36 '
      revision: '4'
      via: "cli\e[m"
    - by: vagrant
      comment: null
      datetime: '2020-07-13 09:28:31 '
      revision: '5'
      via: "cli\e[m"
    - by: vagrant
      comment: "configured by vyos_config\e[m"
      datetime: '2020-07-13 09:28:27 '
      revision: '6'
      via: "cli\e[m"
    - by: root
      comment: null
      datetime: '2020-07-13 09:28:05 '
      revision: '7'
      via: "boot-config-loader\e[m"
    - by: vagrant
      comment: null
      datetime: '2020-02-05 10:32:27 '
      revision: '8'
      via: "cli\e[m"
    - by: vagrant
      comment: null
      datetime: '2020-02-05 10:29:56 '
      revision: '9'
      via: "cli\e[m"
    - by: vagrant
      comment: null
      datetime: '2020-02-05 09:46:05 '
      revision: '10'
      via: "cli\e[m"
    - by: vagrant
      comment: null
      datetime: '2020-02-05 09:27:10 '
      revision: '11'
      via: "cli\e[m"
    - by: vagrant
      comment: null
      datetime: '2020-02-05 09:25:30 '
      revision: '12'
      via: "cli\e[m"
    - by: vyos
      comment: null
      datetime: '2020-02-05 09:14:16 '
      revision: '13'
      via: "cli\e[m"
    - by: vyos
      comment: null
      datetime: '2020-02-05 09:10:29 '
      revision: '14'
      via: "cli\e[m"
    - by: vyos
      comment: null
      datetime: '2020-02-05 09:10:19 '
      revision: '15'
      via: "cli\e[m"
    - by: root
      comment: null
      datetime: '2020-02-05 09:09:06 '
      revision: '16'
      via: "boot-config-loader\e[m"
    ansible_net_config:
    - |-
      set interfaces ethernet eth0 address 'dhcp'[m
      set interfaces ethernet eth0 hw-id '08:00:27:cf:54:d5'[m
      set interfaces ethernet eth1 hw-id '08:00:27:7b:6e:55'[m
      set interfaces ethernet eth2 hw-id '08:00:27:8a:84:fe'[m
      set interfaces ethernet eth3 hw-id '08:00:27:65:b6:67'[m
      set interfaces ethernet eth4 hw-id '08:00:27:12:a0:e9'[m
      set interfaces ethernet eth5 hw-id '08:00:27:08:86:3b'[m
      set interfaces loopback lo[m
      set service ssh disable-host-validation[m
      set service ssh port '22'[m
      set system config-management commit-revisions '20'[m
      set system console device ttyS0 speed '115200'[m
      set system host-name 'vyos'[m
      set system login user vagrant authentication encrypted-password '$6$y8n2l.nAL6byU$.ESxKj7K4wwm.lpf46ckUY0AI.lkezzfJLiS/4ud4Mo.ukhxzWKRQZxjyAUih2E/ZXX7EFxNf1cblgWviI8wb/'[m
      set system login user vagrant authentication plaintext-password ''[m
      set system login user vagrant authentication public-keys vagrant key 'AAAAB3NzaC1yc2EAAAADAQABAAABAQC9cQTmeYT58NGlQAF3LKmEdjvweumyvepakR8A30ohd8m5N0aRvaEWNXpdg0nLLWQI+2YY9IqVd6Ipl6K64pQZVDNUAxNGphQsz4xlQzPsSh0lG572poPdeTvN2rkhL8EL4HcFrCZhYRL5jpWKQ5u6zahdK25qs9L+QeGDI7VGENjXARvLD0z6u2/NlPhdszD0CBIcKRZc+18GiBkoHOTJAj9ChzrMV71vbfXHqrb1AlrUdJ0IUrNnOLkGKWuNkHXD5qfh6phdc+fNtVdbxjkcuKkxoNDSQw8YdQqZGNt0HTpIoBauoWkDC78Ipd3lurK7wTs6l79rca0x5ZUyX3jT'[m
      set system login user vagrant authentication public-keys vagrant type 'ssh-rsa'[m
      set system name-servers-dhcp 'eth0'[m
      set system ntp server 0.pool.ntp.org[m
      set system ntp server 1.pool.ntp.org[m
      set system ntp server 2.pool.ntp.org[m
      set system syslog global facility all level 'info'[m
      set system syslog global facility protocols level 'debug'[m
    - |-
      0   2020-07-13 11:38:45 by vagrant via cli[m
      1   2020-07-13 11:36:01 by vagrant via cli[m
      2   2020-07-13 11:34:33 by vagrant via cli[m
      3   2020-07-13 11:29:15 by root via vyos-boot-config-loader[m
      4   2020-07-13 09:28:36 by vagrant via cli[m
      5   2020-07-13 09:28:31 by vagrant via cli[m
      6   2020-07-13 09:28:27 by vagrant via cli[m
          configured by vyos_config[m
      7   2020-07-13 09:28:05 by root via boot-config-loader[m
      8   2020-02-05 10:32:27 by vagrant via cli[m
      9   2020-02-05 10:29:56 by vagrant via cli[m
      10  2020-02-05 09:46:05 by vagrant via cli[m
      11  2020-02-05 09:27:10 by vagrant via cli[m
      12  2020-02-05 09:25:30 by vagrant via cli[m
      13  2020-02-05 09:14:16 by vyos via cli[m
      14  2020-02-05 09:10:29 by vyos via cli[m
      15  2020-02-05 09:10:19 by vyos via cli[m
      16  2020-02-05 09:09:06 by root via boot-config-loader[m
      17  2020-02-05 09:09:05 by root via init[m
    ansible_net_gather_network_resources: []
    ansible_net_gather_subset:
    - neighbors
    - default
    - config
    ansible_net_hostname: "vyos\e[m"
    ansible_net_neighbors: {}
    ansible_net_python_version: 2.7.16
    ansible_net_serialnum: null
    ansible_net_system: vyos
    ansible_net_version: "VyOS 1.3-rolling-202007130117\e[m"
    ansible_network_resources: {}
    discovered_interpreter_python: /usr/bin/python
  invocation:
    module_args:
      gather_network_resources: null
      gather_subset:
      - all
      provider: null

TASK [Display the config] ************************************************************************************************************
task path: /home/foobar/git/devops/ansible/vagrant/playbooks/boxes/vyos.yml:15
<router.test> attempting to start connection
<router.test> using connection plugin network_cli
<router.test> found existing local domain socket, using it!
<router.test> ssh connection done, setting terminal
<router.test> loaded terminal plugin for network_os vyos
<router.test> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<router.test> firing event: on_open_shell()
<router.test> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<router.test> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<router.test> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<router.test> ssh connection has completed successfully
<router.test> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<router.test> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<router.test> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<router.test> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<router.test> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<router.test> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<router.test> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<router.test> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<router.test> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<router.test> updating play_context for connection
<router.test> 
<router.test> local domain socket path is /home/foobar/.ansible/pc/98284ff3ed
ok: [router] => 
  msg: "The hostname is vyos\e[m and the OS is VyOS 1.3-rolling-202007130117\e[m"
META: ran handlers
META: ran handlers

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


vyos_static_routes uses incorrect attribute name admin_distance

SUMMARY

While trying to replace a default static route I get an error stating that admin_distance parameter is not valid.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

vyos.vyos.vyos_static_routes

ANSIBLE VERSION
ansible 2.10.6
  config file = /fortipoc/ansible/ansible.cfg
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /fortipoc/.venv/lib/python3.7/site-packages/ansible
  executable location = /fortipoc/.venv/bin/ansible
  python version = 3.7.3 (default, Jan 22 2021, 20:04:44) [GCC 8.3.0]
CONFIGURATION
HOST_KEY_CHECKING(/fortipoc/ansible/ansible.cfg) = False
OS / ENVIRONMENT

Target OS:

vyos@vyos:~$ show version

Version:          VyOS 1.4-rolling-202105051111
Release Train:    sagitta

Built by:         [email protected]
Built on:         Thu 06 May 2021 01:17 UTC
Build UUID:       b091cb79-9cb2-46a1-8b14-9dfbd328feec
Build Commit ID:  d3e2f3801f3db1

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:    b3787da7-801a-46fe-96a8-65180524b74c

Copyright:        VyOS maintainers and contributors
STEPS TO REPRODUCE
  1. Playbook file includes a task:
- name: Vyos Provisioning
  hosts: VYOS
  collections:
    - vyos.vyos

  tasks:
    - name: Overrides the default route
      include_tasks: tasks/vyos_default_route.yml
  1. The following is the included task file:
- name: Overrides the default route
  vyos.vyos.vyos_static_routes:
    config:
    - address_families:
      - afi: ipv4
        routes:
        - dest: 0.0.0.0/0
          next_hops:
            - forward_router_address: 10.2.0.1
    state: replaced
  1. Task is executed by its name for troubleshooting purpose

ansible-playbook -i inventory vyos.yml --limit=router-inet --start-at-task="Overrides the default route" -vvvvvv --step

  1. The module generated a default admin_distance 1 which is added to the final Vyos command that is executed.

  2. ansible-playbook failed to execute. Error reported by the module points the admin_distance attribute:

protocols static route 0.0.0.0/0 next-hop 10.0.0.254 [admin_distance] is not valid
EXPECTED RESULTS
  • Module should use the attribute distance instead of admin_distance as a parameter for next-hops.
ACTUAL RESULTS
Using module file /fortipoc/ansible/collections/ansible_collections/vyos/vyos/plugins/modules/vyos_static_routes.py
<10.0.2.254> PUT /root/.ansible/tmp/ansible-local-414761r1rz9eb/tmpf9k17qfa TO /root/.ansible/tmp/ansible-local-414761r1rz9eb/ansible-tmp-1620363492.687145-41491-165637504363267/AnsiballZ_vyos_static_routes.py
<10.0.2.254> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-local-414761r1rz9eb/ansible-tmp-1620363492.687145-41491-165637504363267/ /root/.ansible/tmp/ansible-local-414761r1rz9eb/ansible-tmp-1620363492.687145-41491-165637504363267/AnsiballZ_vyos_static_routes.py && sleep 0'
<10.0.2.254> EXEC /bin/sh -c '$VIRTUAL_ENV/bin/python /root/.ansible/tmp/ansible-local-414761r1rz9eb/ansible-tmp-1620363492.687145-41491-165637504363267/AnsiballZ_vyos_static_routes.py && sleep 0'
<10.0.2.254> EXEC /bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-local-414761r1rz9eb/ansible-tmp-1620363492.687145-41491-165637504363267/ > /dev/null 2>&1 && sleep 0'
The full traceback is:
Traceback (most recent call last):
  File "/root/.ansible/tmp/ansible-local-414761r1rz9eb/ansible-tmp-1620363492.687145-41491-165637504363267/AnsiballZ_vyos_static_routes.py", line 102, in <module>
    _ansiballz_main()
  File "/root/.ansible/tmp/ansible-local-414761r1rz9eb/ansible-tmp-1620363492.687145-41491-165637504363267/AnsiballZ_vyos_static_routes.py", line 94, in _ansiballz_main
    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
  File "/root/.ansible/tmp/ansible-local-414761r1rz9eb/ansible-tmp-1620363492.687145-41491-165637504363267/AnsiballZ_vyos_static_routes.py", line 40, in invoke_module
    runpy.run_module(mod_name='ansible_collections.vyos.vyos.plugins.modules.vyos_static_routes', init_globals=None, run_name='__main__', alter_sys=True)
  File "/usr/lib/python3.7/runpy.py", line 205, in run_module
    return _run_module_code(code, init_globals, run_name, mod_spec)
  File "/usr/lib/python3.7/runpy.py", line 96, in _run_module_code
    mod_name, mod_spec, pkg_name, script_name)
  File "/usr/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/tmp/ansible_vyos.vyos.vyos_static_routes_payload_nme6trh0/ansible_vyos.vyos.vyos_static_routes_payload.zip/ansible_collections/vyos/vyos/plugins/modules/vyos_static_routes.py", line 937, in <module>
  File "/tmp/ansible_vyos.vyos.vyos_static_routes_payload_nme6trh0/ansible_vyos.vyos.vyos_static_routes_payload.zip/ansible_collections/vyos/vyos/plugins/modules/vyos_static_routes.py", line 932, in main
  File "/tmp/ansible_vyos.vyos.vyos_static_routes_payload_nme6trh0/ansible_vyos.vyos.vyos_static_routes_payload.zip/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/config/static_routes/static_routes.py", line 91, in execute_module
  File "/tmp/ansible_vyos.vyos.vyos_static_routes_payload_nme6trh0/ansible_vyos.vyos.vyos_static_routes_payload.zip/ansible/module_utils/connection.py", line 195, in __rpc__
ansible.module_utils.connection.ConnectionError: delete protocols static route 0.0.0.0/0 next-hop 10.0.0.254 admin_distance '1'

  Configuration path: protocols static route 0.0.0.0/0 next-hop 10.0.0.254 [admin_distance] is not valid
  Delete failed

[edit]
vyos@vyos#
fatal: [router-inet]: FAILED! => {
    "changed": false,
    "module_stderr": "Traceback (most recent call last):\n  File \"/root/.ansible/tmp/ansible-local-414761r1rz9eb/ansible-tmp-1620363492.687145-41491-165637504363267/AnsiballZ_vyos_static_routes.py\", line 102, in <module>\n    _ansiballz_main()\n  File \"/root/.ansible/tmp/ansible-local-414761r1rz9eb/ansible-tmp-1620363492.687145-41491-165637504363267/AnsiballZ_vyos_static_routes.py\", line 94, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n  File \"/root/.ansible/tmp/ansible-local-414761r1rz9eb/ansible-tmp-1620363492.687145-41491-165637504363267/AnsiballZ_vyos_static_routes.py\", line 40, in invoke_module\n    runpy.run_module(mod_name='ansible_collections.vyos.vyos.plugins.modules.vyos_static_routes', init_globals=None, run_name='__main__', alter_sys=True)\n  File \"/usr/lib/python3.7/runpy.py\", line 205, in run_module\n    return _run_module_code(code, init_globals, run_name, mod_spec)\n  File \"/usr/lib/python3.7/runpy.py\", line 96, in _run_module_code\n    mod_name, mod_spec, pkg_name, script_name)\n  File \"/usr/lib/python3.7/runpy.py\", line 85, in _run_code\n    exec(code, run_globals)\n  File \"/tmp/ansible_vyos.vyos.vyos_static_routes_payload_nme6trh0/ansible_vyos.vyos.vyos_static_routes_payload.zip/ansible_collections/vyos/vyos/plugins/modules/vyos_static_routes.py\", line 937, in <module>\n  File \"/tmp/ansible_vyos.vyos.vyos_static_routes_payload_nme6trh0/ansible_vyos.vyos.vyos_static_routes_payload.zip/ansible_collections/vyos/vyos/plugins/modules/vyos_static_routes.py\", line 932, in main\n  File \"/tmp/ansible_vyos.vyos.vyos_static_routes_payload_nme6trh0/ansible_vyos.vyos.vyos_static_routes_payload.zip/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/config/static_routes/static_routes.py\", line 91, in execute_module\n  File \"/tmp/ansible_vyos.vyos.vyos_static_routes_payload_nme6trh0/ansible_vyos.vyos.vyos_static_routes_payload.zip/ansible/module_utils/connection.py\", line 195, in __rpc__\nansible.module_utils.connection.ConnectionError: delete protocols static route 0.0.0.0/0 next-hop 10.0.0.254 admin_distance '1'\r\n\r\n  Configuration path: protocols static route 0.0.0.0/0 next-hop 10.0.0.254 [admin_distance] is not valid\r\n  Delete failed\r\n\r\n[edit]\r\r\nvyos@vyos# \n",
    "module_stdout": "",
    "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
    "rc": 1
}

PLAY RECAP ***********************************************************************************************************************************************************************************************************************************
router-inet                : ok=1    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0

IPV6 ICMP type name in vyos.vyos.vyos_firewall_rules is not idempotent

SUMMARY
icmp:
 type_name: echo-request

For IPV6 is not idempotent

ISSUE TYPE
  • Bug Report
COMPONENT NAME
ANSIBLE VERSION
ansible [core 2.11.1] 
  config file = /var/home/anthonyjrabbito/dev/infra/ansible/ansible.cfg
  configured module search path = ['/var/home/anthonyjrabbito/dev/infra/ansible/library', '/var/home/anthonyjrabbito/dev/infra/ansible/kubespray/library', '/var/home/anthonyjrabbito/dev/infra/ansible/k8s-cluster-installation/ansible/library']
  ansible python module location = /usr/lib/python3.9/site-packages/ansible
  ansible collection location = /var/home/anthonyjrabbito/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/sbin/ansible
  python version = 3.9.5 (default, May 24 2021, 12:50:35) [GCC 11.1.0]
  jinja version = 3.0.1
  libyaml = True
CONFIGURATION
CACHE_PLUGIN(/var/home/anthonyjrabbito/dev/infra/ansible/ansible.cfg) = jsonfile
CACHE_PLUGIN_CONNECTION(/var/home/anthonyjrabbito/dev/infra/ansible/ansible.cfg) = /tmp
CACHE_PLUGIN_TIMEOUT(/var/home/anthonyjrabbito/dev/infra/ansible/ansible.cfg) = 7200
CALLBACKS_ENABLED(/var/home/anthonyjrabbito/dev/infra/ansible/ansible.cfg) = ['profile_tasks']
DEFAULT_GATHERING(/var/home/anthonyjrabbito/dev/infra/ansible/ansible.cfg) = smart
DEFAULT_HOST_LIST(/var/home/anthonyjrabbito/dev/infra/ansible/ansible.cfg) = ['/var/home/anthonyjrabbito/dev/infra/ansible/inventory/inventory.ini']
DEFAULT_MODULE_PATH(/var/home/anthonyjrabbito/dev/infra/ansible/ansible.cfg) = ['/var/home/anthonyjrabbito/dev/infra/ansible/library', '/var/home/anthonyjrabbito/dev/infra/ansible/kubespray/library', '/var/home/anthonyjrabbito/dev/infra/ansible/k8s-cluster-installation/ansible/library']
DEFAULT_ROLES_PATH(/var/home/anthonyjrabbito/dev/infra/ansible/ansible.cfg) = ['/var/home/anthonyjrabbito/dev/infra/ansible/roles', '/var/home/anthonyjrabbito/dev/infra/ansible/$VIRTUAL_ENV/usr/local/share/kubespray/roles', '/var/home/anthonyjrabbito/dev/infra/ansible/$VIRTUAL_ENV/usr/local/share/ansible/roles', '/usr/share/kubespray/roles', '/var/home/anthonyjrabbito/dev/infra/ansible/kubespray/roles', '/var/home/anthonyjrabbito/dev/infra/ansible/k8s-cluster-installation/ansible/roles']
DEFAULT_STDOUT_CALLBACK(/var/home/anthonyjrabbito/dev/infra/ansible/ansible.cfg) = default
DEFAULT_STRATEGY_PLUGIN_PATH(/var/home/anthonyjrabbito/dev/infra/ansible/ansible.cfg) = ['/var/home/anthonyjrabbito/dev/infra/ansible/plugins/mitogen/ansible_mitogen/plugins/strategy']
DEPRECATION_WARNINGS(/var/home/anthonyjrabbito/dev/infra/ansible/ansible.cfg) = False
DISPLAY_SKIPPED_HOSTS(/var/home/anthonyjrabbito/dev/infra/ansible/ansible.cfg) = False
HOST_KEY_CHECKING(/var/home/anthonyjrabbito/dev/infra/ansible/ansible.cfg) = False
INVENTORY_IGNORE_EXTS(/var/home/anthonyjrabbito/dev/infra/ansible/ansible.cfg) = ['~', '.orig', '.bak', '.ini', '.cfg', '.retry', '.pyc', '.pyo', '.creds', '.gpg']
INVENTORY_IGNORE_PATTERNS(/var/home/anthonyjrabbito/dev/infra/ansible/ansible.cfg) = ['artifacts', 'credentials']
TRANSFORM_INVALID_GROUP_CHARS(/var/home/anthonyjrabbito/dev/infra/ansible/ansible.cfg) = ignore
VARIABLE_PLUGINS_ENABLED(/var/home/anthonyjrabbito/dev/infra/ansible/ansible.cfg) = ['host_group_vars', 'community.sops.sops']
OS / ENVIRONMENT
cat /etc/os-release 

PRETTY_NAME="VyOS 1.4-rolling-202104300710 (sagitta)"
NAME="VyOS"
VERSION_ID="1.4-rolling-202104300710"
VERSION="1.4-rolling-202104300710 (sagitta)"
VERSION_CODENAME=buster
ID=vyos
HOME_URL="https://vyos.io"
SUPPORT_URL="https://support.vyos.io"
BUG_REPORT_URL="https://phabricator.vyos.net"
STEPS TO REPRODUCE
- name: configure OUTSIDE-LOCAL firewall rules
  vyos.vyos.vyos_firewall_rules:
    config:
      - afi: ipv6
        rule_sets:
          - name: V6-OUTSIDE-LOCAL
            description: local WAN ruleset
            default_action: drop
            rules:
              - number: 10
                action: accept
                description: 'rule 10 configured by ansible'
                state:
                  established: true
                  related: true
              - number: 20
                action: accept
                protocol: icmp
                icmp: <----- **Not idempotent**
                  type_name: echo-request <---- **Not idempotent**
                description: 'rule 20 configured by ansible'
                state:
                  new: true
EXPECTED RESULTS

No Changes

ok=31 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0

ACTUAL RESULTS

ok=32 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0

{
    "after": [
        {
            "afi": "ipv6",
            "rule_sets": [
                {
                    "default_action": "drop",
                    "description": "local WAN ruleset",
                    "name": "V6-OUTSIDE-LOCAL",
                    "rules": [
                        {
                            "action": "accept",
                            "description": "rule 10 configured by ansible",
                            "number": 10,
                            "state": {
                                "established": true,
                                "related": true
                            }
                        },
                        {
                            "action": "accept",
                            "description": "rule 20 configured by ansible",
                            "number": 20,
                            "protocol": "icmp",
                            "state": {
                                "new": true
                            }
                        }
                    ]
                },
                {
                    "default_action": "drop",
                    "description": "incoming WAN ruleset",
                    "name": "V6-OUTSIDE-IN",
                    "rules": [
                        {
                            "action": "accept",
                            "description": "rule 10 configured by ansible",
                            "number": 10,
                            "state": {
                                "established": true,
                                "related": true
                            }
                        }
                    ]
                }
            ]
        },
        {
            "afi": "ipv4",
            "rule_sets": [
                {
                    "default_action": "drop",
                    "description": "incoming WAN ruleset",
                    "name": "OUTSIDE-IN",
                    "rules": [
                        {
                            "action": "accept",
                            "description": "rule 10 configured by ansible",
                            "number": 10,
                            "state": {
                                "established": true,
                                "related": true
                            }
                        }
                    ]
                },
                {
                    "default_action": "drop",
                    "description": "local WAN ruleset",
                    "name": "OUTSIDE-LOCAL",
                    "rules": [
                        {
                            "action": "accept",
                            "description": "rule 10 configured by ansible",
                            "number": 10,
                            "state": {
                                "established": true,
                                "related": true
                            }
                        },
                        {
                            "action": "accept",
                            "description": "rule 20 configured by ansible",
                            "icmp": {
                                "type_name": "echo-request"
                            },
                            "number": 20,
                            "protocol": "icmp",
                            "state": {
                                "new": true
                            }
                        }
                    ]
                }
            ]
        }
    ],
    "before": [
        {
            "afi": "ipv6",
            "rule_sets": [
                {
                    "default_action": "drop",
                    "description": "local WAN ruleset",
                    "name": "V6-OUTSIDE-LOCAL",
                    "rules": [
                        {
                            "action": "accept",
                            "description": "rule 10 configured by ansible",
                            "number": 10,
                            "state": {
                                "established": true,
                                "related": true
                            }
                        },
                        {
                            "action": "accept",
                            "description": "rule 20 configured by ansible",
                            "number": 20,
                            "protocol": "icmp",
                            "state": {
                                "new": true
                            }
                        }
                    ]
                },
                {
                    "default_action": "drop",
                    "description": "incoming WAN ruleset",
                    "name": "V6-OUTSIDE-IN",
                    "rules": [
                        {
                            "action": "accept",
                            "description": "rule 10 configured by ansible",
                            "number": 10,
                            "state": {
                                "established": true,
                                "related": true
                            }
                        }
                    ]
                }
            ]
        },
        {
            "afi": "ipv4",
            "rule_sets": [
                {
                    "default_action": "drop",
                    "description": "incoming WAN ruleset",
                    "name": "OUTSIDE-IN",
                    "rules": [
                        {
                            "action": "accept",
                            "description": "rule 10 configured by ansible",
                            "number": 10,
                            "state": {
                                "established": true,
                                "related": true
                            }
                        }
                    ]
                },
                {
                    "default_action": "drop",
                    "description": "local WAN ruleset",
                    "name": "OUTSIDE-LOCAL",
                    "rules": [
                        {
                            "action": "accept",
                            "description": "rule 10 configured by ansible",
                            "number": 10,
                            "state": {
                                "established": true,
                                "related": true
                            }
                        },
                        {
                            "action": "accept",
                            "description": "rule 20 configured by ansible",
                            "icmp": {
                                "type_name": "echo-request"
                            },
                            "number": 20,
                            "protocol": "icmp",
                            "state": {
                                "new": true
                            }
                        }
                    ]
                }
            ]
        }
    ],
    "changed": true,
    "commands": [
        "set firewall ipv6-name V6-OUTSIDE-LOCAL rule 20 icmpv6 type echo-request"
    ],
    "invocation": {
        "module_args": {
            "config": [
                {
                    "afi": "ipv6",
                    "rule_sets": [
                        {
                            "default_action": "drop",
                            "description": "local WAN ruleset",
                            "enable_default_log": null,
                            "name": "V6-OUTSIDE-LOCAL",
                            "rules": [
                                {
                                    "action": "accept",
                                    "description": "rule 10 configured by ansible",
                                    "number": 10,
                                    "state": {
                                        "established": true,
                                        "related": true
                                    }
                                },
                                {
                                    "action": "accept",
                                    "description": "rule 20 configured by ansible",
                                    "icmp": {
                                        "type_name": "echo-request"
                                    },
                                    "number": 20,
                                    "protocol": "icmp",
                                    "state": {
                                        "new": true
                                    }
                                }
                            ]
                        }
                    ]
                },
                {
                    "afi": "ipv4",
                    "rule_sets": [
                        {
                            "default_action": "drop",
                            "description": "local WAN ruleset",
                            "enable_default_log": null,
                            "name": "OUTSIDE-LOCAL",
                            "rules": [
                                {
                                    "action": "accept",
                                    "description": "rule 10 configured by ansible",
                                    "number": 10,
                                    "state": {
                                        "established": true,
                                        "related": true
                                    }
                                },
                                {
                                    "action": "accept",
                                    "description": "rule 20 configured by ansible",
                                    "number": 20,
                                    "protocol": "icmp",
                                    "state": {
                                        "new": true
                                    }
                                }
                            ]
                        }
                    ]
                }
            ],
            "running_config": null,
            "state": "merged"
        }
    }
}

Include openvpn interfaces in ansible_network_resources in output form vyos_facts

SUMMARY

The name and ip-address of openvpn interfaces are missing in the information gathered by the vyos_facts module

ISSUE TYPE

Ipsec vti-interfaces are already included in the ansible_network_resources.l3_interfaces, but openvpn vtun interfaces are missing.

COMPONENT NAME

vyos_facts

ADDITIONAL INFORMATION

My use-case is that I'm trying to automate creation and verification of firewall rules. We use openvpn for site2site tunnels and have firewall rules for those interfaces as well. Currently we are using a workaround by manually listing openvpn interfaces as host_vars, but it would be great to be able to dynamically discover openvpn interfaces in the same way as ethernet interfaces and ipsec interfaces.

    - name: Extract the interface list 
      set_fact:
        vyos_facts_interfaces: "{{ ansible_facts | json_query(_query) | list }}"
      vars:
        _query: "ansible_network_resources.l3_interfaces[].name"

    - name: Crete all firewall rules for the interfaces based on yaml-configuration
      include_tasks: template_interface_rules.yml
      with_items: "{{ vyos_facts_interfaces }}"
      loop_control:
        loop_var: interface

Currently the vyos_facts_interfaces variable will contain all ethternet and ipsec interfaces, but the vtunX interfaces from openvpn connections are missing.

Mask sensitive keys in task result

Sensitive keys (including but not limited to the ones detected by validate-modules) should have no_log: True so that their values are correctly redacted from the task result.
Also bump the min requirement for netcommon up in galaxy.yml "ansible.netcommon": ">=2.0.1".

Connection to “VyOS on AWS” not possible

SUMMARY

vyos_config works perfectly for vyOS router which are deployed on VMWare or any other hypervisor. However, if I use “VyOS on AWS” it does not work.

The main difference is that you have to use public key to connect to the cloud instances, maybe this is the issue here, but I can't see any packets leaving the Ansible host via tcpdump

In AWS you have to use a public key to

ISSUE TYPE
  • Bug Report
COMPONENT NAME
ANSIBLE VERSION
ansible 2.9.12
  config file = /home/admin/silverpeak-cisco-poc-automation/ansible.cfg
  configured module search path = ['/home/admin/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.6/site-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 3.6.8 (default, Apr 16 2020, 01:36:27) [GCC 8.3.1 20191121 (Red Hat 8.3.1-5)]
COLLECTION VERSION
2.4.0:
    changes:
      minor_changes:
      - Add vyos_prefix_lists Resource Module.
    fragments:
    - vyos_prefix_lists.yml
    modules:
    - description: Prefix-Lists resource module for VyOS
      name: vyos_prefix_lists
      namespace: ''
    release_date: '2021-07-06'
OS / ENVIRONMENT

CentOS 7

STEPS TO REPRODUCE

This is the working onPrem Playbook:

---
- name: "render a Jinja2 template onto the VyOS router"
  vyos.vyos.vyos_config:
    src: templates/{{ template }}
    provider:
  register: config

- name: "save config localy for debugging"
  template:
    src: templates/{{ template }}
    dest: files/{{ hostname }}.txt
    mode: 0666
    lstrip_blocks: yes

This is what I put in my inventory file under host_vars:

[cat host_vars/1-Europe-vyOS-AWS-Site1.yml 
---
  
  ansible_host: 18.159.207.56
  ansible_connection: ansible.netcommon.network_cli
  ansible_network_os: vyos.vyos.vyos
  ansible_user: vyos
  #ansible_become: yes
  hostname: "some-host-name"
  site: 1
  --snip--

and this is the error message:

TASK [configure_vyos_router : render a Jinja2 template onto the VyOS router] ****************************************************************************************************************
task path: /home/admin/silverpeak-cisco-poc-automation/roles/configure_vyos_router/tasks/main.yml:9
<{'sensitive': False, 'type': 'string', 'value': '18.159.207.56'}> attempting to start connection
<{'sensitive': False, 'type': 'string', 'value': '18.159.207.56'}> using connection plugin ansible.netcommon.network_cli
<{'sensitive': False, 'type': 'string', 'value': '18.159.207.56'}> found existing local domain socket, using it!
<{'sensitive': False, 'type': 'string', 'value': '18.159.207.56'}> updating play_context for connection
<{'sensitive': False, 'type': 'string', 'value': '18.159.207.56'}> 
<{'sensitive': False, 'type': 'string', 'value': '18.159.207.56'}> local domain socket path is /home/admin/.ansible/pc/14a1808d10
<{'sensitive': False, 'type': 'string', 'value': '18.159.207.56'}> ESTABLISH LOCAL CONNECTION FOR USER: admin
<{'sensitive': False, 'type': 'string', 'value': '18.159.207.56'}> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/admin/.ansible/tmp/ansible-local-2150006pm1rpeg0 `"&& mkdir "` echo /home/admin/.ansible/tmp/ansible-local-2150006pm1rpeg0/ansible-tmp-1625649121.269041-2150520-270375937016727 `" && echo ansible-tmp-1625649121.269041-2150520-270375937016727="` echo /home/admin/.ansible/tmp/ansible-local-2150006pm1rpeg0/ansible-tmp-1625649121.269041-2150520-270375937016727 `" ) && sleep 0'
<1-Europe-vyOS-AWS-Site1> Attempting python interpreter discovery
<{'sensitive': False, 'type': 'string', 'value': '18.159.207.56'}> EXEC /bin/sh -c 'echo PLATFORM; uname; echo FOUND; command -v '"'"'/usr/bin/python'"'"'; 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'
<{'sensitive': False, 'type': 'string', 'value': '18.159.207.56'}> EXEC /bin/sh -c '/usr/bin/python3.6 && sleep 0'
Using module file /home/admin/.ansible/collections/ansible_collections/vyos/vyos/plugins/modules/vyos_config.py
<{'sensitive': False, 'type': 'string', 'value': '18.159.207.56'}> PUT /home/admin/.ansible/tmp/ansible-local-2150006pm1rpeg0/tmpqfw1m7jp TO /home/admin/.ansible/tmp/ansible-local-2150006pm1rpeg0/ansible-tmp-1625649121.269041-2150520-270375937016727/AnsiballZ_vyos_config.py
<{'sensitive': False, 'type': 'string', 'value': '18.159.207.56'}> EXEC /bin/sh -c 'chmod u+x /home/admin/.ansible/tmp/ansible-local-2150006pm1rpeg0/ansible-tmp-1625649121.269041-2150520-270375937016727/ /home/admin/.ansible/tmp/ansible-local-2150006pm1rpeg0/ansible-tmp-1625649121.269041-2150520-270375937016727/AnsiballZ_vyos_config.py && sleep 0'
<{'sensitive': False, 'type': 'string', 'value': '18.159.207.56'}> EXEC /bin/sh -c 'sudo -H -S  -p "[sudo via ansible, key=eyhjrwvinrkzimobfewbghcwnpdmyxte] password:" -u root /bin/sh -c '"'"'echo BECOME-SUCCESS-eyhjrwvinrkzimobfewbghcwnpdmyxte ; /usr/libexec/platform-python /home/admin/.ansible/tmp/ansible-local-2150006pm1rpeg0/ansible-tmp-1625649121.269041-2150520-270375937016727/AnsiballZ_vyos_config.py'"'"' && sleep 0'
<{'sensitive': False, 'type': 'string', 'value': '18.159.207.56'}> EXEC /bin/sh -c 'rm -f -r /home/admin/.ansible/tmp/ansible-local-2150006pm1rpeg0/ansible-tmp-1625649121.269041-2150520-270375937016727/ > /dev/null 2>&1 && sleep 0'
The full traceback is:
  File "/tmp/ansible_vyos.vyos.vyos_config_payload_msjc2ykd/ansible_vyos.vyos.vyos_config_payload.zip/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/vyos.py", line 84, in get_capabilities
    capabilities = Connection(module._socket_path).get_capabilities()
  File "/tmp/ansible_vyos.vyos.vyos_config_payload_msjc2ykd/ansible_vyos.vyos.vyos_config_payload.zip/ansible/module_utils/connection.py", line 185, in __rpc__
    raise ConnectionError(to_text(msg, errors='surrogate_then_replace'), code=code)
fatal: [1-Europe-vyOS-AWS-Site1]: FAILED! => changed=false 
  ansible_facts:
    discovered_interpreter_python: /usr/libexec/platform-python
  invocation:
    module_args:
      backup: false
      backup_options: null
      comment: configured by vyos_config
      config: null
      lines: null
      match: line
      provider: null
      save: false
      src: |-
        set interfaces ethernet eth1  address '10.0.12.10/24'
        set interfaces ethernet eth1 description 'to SD-WAN'
        set interfaces ethernet eth2  address '10.0.11.5/24'
        set interfaces ethernet eth2 description 'to LAN'
        set interfaces loopback lo address '11.0.1.1/32'
        set protocols bgp 65101 neighbor 10.0.12.5 remote-as '11'
        set protocols bgp 65101 parameters log-neighbor-changes
        set protocols bgp 65101 address-family ipv4-unicast redistribute 'connected'
        set protocols bgp 65101 parameters router-id '11.0.1.1'
        set system host-name '1-Europe-vyOS-AWS-Site1'
  msg: '[Errno -2] Name or service not known'

PLAY RECAP **********************************************************************************************************************************************************************************
1-Europe-vyOS-AWS-Site1    : ok=2    changed=0    unreachable=0    failed=1    skipped=5    rescued=0    ignored=0   
localhost                  : ok=4    changed=0

It seams that it does not try to do a ssh connetion, I could not capture anything with tcpdump.

Long config entries cause incorrect reading of device config

SUMMARY

Setting config options with very long entries (>512), cause incorrect reading of the device config. I noticed this when setting the an ssh-rsa pubkey using the vyos_config module, as it would constantly claim that the key I am setting is different from the key found on the device, causing ansible to consider the task as "changed". When looking at the commands that come from the device and get compared to the desired config, I noticed that the 513th character in the line would get replaces by a space.

A dirty fix for this is to increase the terminal width to 1024 in https://github.com/ansible-collections/vyos.vyos/blob/main/plugins/terminal/vyos.py#L70

ISSUE TYPE
  • Bug Report
COMPONENT NAME

vyos_config
terminal

ANSIBLE VERSION
ansible [core 2.11.6] 
  python version = 3.8.10 (default, Sep 28 2021, 16:10:42) [GCC 9.3.0]
  jinja version = 3.0.2
  libyaml = True
COLLECTION VERSION
https://github.com/lucaelin/vyos.vyos
CONFIGURATION

OS / ENVIRONMENT
STEPS TO REPRODUCE
- name: test ssh
  vyos_config:
    lines: 
      - set system login user ansible authentication public-keys ansible key 'veryveryveryveryverylongsshkey=='
EXPECTED RESULTS

The task should be ok when applied multiple times

ACTUAL RESULTS

The task is changed when applied multiple times


`vyos.vyos.vyos_firewall_rules` cannot replace a single rule set

SUMMARY

While the documentation (via the examples section) indicates that state: replaced replaces the device configuration of the listed firewall rules, in reality vyos.vyos.vyos_firewall_rules will try to delete other rules not listed in the configuration.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

vyos.vyos.vyos_firewall_rules

ANSIBLE VERSION
ansible 2.10.12
  config file = /home/sdwilsh/ansible-playbooks/ansible.cfg
  configured module search path = ['/home/sdwilsh/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3/dist-packages/ansible
  executable location = /usr/bin/ansible
  python version = 3.8.10 (default, Jun  2 2021, 10:49:15) [GCC 9.4.0]
COLLECTION VERSION
# /home/sdwilsh/.ansible/collections/ansible_collections
Collection Version
---------- -------
vyos.vyos  2.5.0  
[WARNING]: Collection at '/home/sdwilsh/ansible-collection-dev/ansible_collections/vyos/vyos' does not have a valid version set, falling back to '*'. Found version: 'None'

# /home/sdwilsh/ansible-collection-dev/ansible_collections
Collection Version
---------- -------
vyos.vyos  * 
CONFIGURATION
COLLECTIONS_PATHS(/home/sdwilsh/ansible-playbooks/ansible.cfg) = ['/home/sdwilsh/ansible-collection-dev', '/home/sdwilsh/.ansible/collections', '/usr/share/ansible/collections']
DEFAULT_HOST_LIST(/home/sdwilsh/ansible-playbooks/ansible.cfg) = ['/home/sdwilsh/ansible-playbooks/prod-inventory']
DEFAULT_REMOTE_USER(/home/sdwilsh/ansible-playbooks/ansible.cfg) = ansible
DEFAULT_ROLES_PATH(/home/sdwilsh/ansible-playbooks/ansible.cfg) = ['/home/sdwilsh/ansible-playbooks/roles', '/home/sdwilsh/.ansible/roles']
DEFAULT_SCP_IF_SSH(/home/sdwilsh/ansible-playbooks/ansible.cfg) = true
DEFAULT_VAULT_PASSWORD_FILE(/home/sdwilsh/ansible-playbooks/ansible.cfg) = /home/sdwilsh/ansible-playbooks/.ansible_vault_password
INTERPRETER_PYTHON(/home/sdwilsh/ansible-playbooks/ansible.cfg) = auto
PERSISTENT_COMMAND_TIMEOUT(/home/sdwilsh/ansible-playbooks/ansible.cfg) = 180
OS / ENVIRONMENT

I'm targeting vyos 1.3 rc5, but given the commands being run, I don't think it matters.

STEPS TO REPRODUCE
- name: Setup two rules for testing issue
  vyos.vyos.vyos_firewall_rules:
    config:
    - afi: ipv4
      rule_sets:
      - name: TEST
        default_action: drop
        rules:
        - number: 1
          action: accept
          state:
            established: true
            related: true
        - number: 2
          action: drop
          state:
            invalid: true
        - number: 3
          action: accept
          protocol: icmp
          icmp:
            type_name: any
        - number: 4
          action: accept
          protocol: vrrp
      - name: UNTOUCHED
        default_action: drop
        rules:
        - number: 1
          action: accept
          state:
            established: true
            related: true
        - number: 2
          action: drop
          state:
            invalid: true
    state: merged
- name: Replace device configurations of listed firewall rules with provided configurations
  vyos.vyos.vyos_firewall_rules:
    config:
    - afi: ipv4
      rule_sets:
      - name: TEST
        default_action: drop
        rules:
        - number: 1
          action: accept
          state:
            established: true
            related: true
        - number: 2
          action: drop
          state:
            invalid: true
        - number: 3
          action: accept
          protocol: vrrp
        - number: 4
          action: accept
          protocol: icmp
          icmp:
            type_name: any
    state: replaced
EXPECTED RESULTS

Firewall rule UNTOUCHED does not get changed, and TEST rules 3 and 4 change their order.

ACTUAL RESULTS

UNTOUCHED, and any additional firewall rules are deleted (if they aren't in use, at least).

I skipped the setup step below, since it has a ton of output due to a large number of firewall rules for various zones on the box I ran it on (one of which you can see in the error message was being deleted, and why the command failed).

TASK [Replace device configurations of listed firewall rules with provided configurations] ***
task path: /home/sdwilsh/ansible-playbooks/test.yml:44
redirecting (type: connection) ansible.builtin.network_cli to ansible.netcommon.network_cli
redirecting (type: terminal) ansible.builtin.vyos to vyos.vyos.vyos
redirecting (type: cliconf) ansible.builtin.vyos to vyos.vyos.vyos
redirecting (type: action) vyos.vyos.vyos_firewall_rules to vyos.vyos.vyos
redirecting (type: action) vyos.vyos.vyos_firewall_rules to vyos.vyos.vyos
<10.10.0.48> ESTABLISH LOCAL CONNECTION FOR USER: sdwilsh
<10.10.0.48> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/sdwilsh/.ansible/tmp/ansible-local-565013_tnwu0sb `"&& mkdir "` echo /home/sdwilsh/.ansible/tmp/ansible-local-565013_tnwu0sb/ansible-tmp-1629729912.218707-565503-246921439531834 `" && echo ansible-tmp-1629729912.218707-565503-246921439531834="` echo /home/sdwilsh/.ansible/tmp/ansible-local-565013_tnwu0sb/ansible-tmp-1629729912.218707-565503-246921439531834 `" ) && sleep 0'
Using module file /home/sdwilsh/ansible-collection-dev/ansible_collections/vyos/vyos/plugins/modules/vyos_firewall_rules.py
<10.10.0.48> PUT /home/sdwilsh/.ansible/tmp/ansible-local-565013_tnwu0sb/tmpd9qnzsim TO /home/sdwilsh/.ansible/tmp/ansible-local-565013_tnwu0sb/ansible-tmp-1629729912.218707-565503-246921439531834/AnsiballZ_vyos_firewall_rules.py
<10.10.0.48> EXEC /bin/sh -c 'chmod u+x /home/sdwilsh/.ansible/tmp/ansible-local-565013_tnwu0sb/ansible-tmp-1629729912.218707-565503-246921439531834/ /home/sdwilsh/.ansible/tmp/ansible-local-565013_tnwu0sb/ansible-tmp-1629729912.218707-565503-246921439531834/AnsiballZ_vyos_firewall_rules.py && sleep 0'
<10.10.0.48> EXEC /bin/sh -c '/usr/bin/python3 /home/sdwilsh/.ansible/tmp/ansible-local-565013_tnwu0sb/ansible-tmp-1629729912.218707-565503-246921439531834/AnsiballZ_vyos_firewall_rules.py && sleep 0'
<10.10.0.48> EXEC /bin/sh -c 'rm -f -r /home/sdwilsh/.ansible/tmp/ansible-local-565013_tnwu0sb/ansible-tmp-1629729912.218707-565503-246921439531834/ > /dev/null 2>&1 && sleep 0'
The full traceback is:
Traceback (most recent call last):
  File "/home/sdwilsh/.ansible/tmp/ansible-local-565013_tnwu0sb/ansible-tmp-1629729912.218707-565503-246921439531834/AnsiballZ_vyos_firewall_rules.py", line 102, in <module>
    _ansiballz_main()
  File "/home/sdwilsh/.ansible/tmp/ansible-local-565013_tnwu0sb/ansible-tmp-1629729912.218707-565503-246921439531834/AnsiballZ_vyos_firewall_rules.py", line 94, in _ansiballz_main
    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
  File "/home/sdwilsh/.ansible/tmp/ansible-local-565013_tnwu0sb/ansible-tmp-1629729912.218707-565503-246921439531834/AnsiballZ_vyos_firewall_rules.py", line 40, in invoke_module
    runpy.run_module(mod_name='ansible_collections.vyos.vyos.plugins.modules.vyos_firewall_rules', init_globals=None, run_name='__main__', alter_sys=True)
  File "/usr/lib/python3.8/runpy.py", line 207, in run_module
    return _run_module_code(code, init_globals, run_name, mod_spec)
  File "/usr/lib/python3.8/runpy.py", line 97, in _run_module_code
    _run_code(code, mod_globals, init_globals,
  File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/tmp/ansible_vyos.vyos.vyos_firewall_rules_payload_1ensys4h/ansible_vyos.vyos.vyos_firewall_rules_payload.zip/ansible_collections/vyos/vyos/plugins/modules/vyos_firewall_rules.py", line 1514, in <module>
  File "/tmp/ansible_vyos.vyos.vyos_firewall_rules_payload_1ensys4h/ansible_vyos.vyos.vyos_firewall_rules_payload.zip/ansible_collections/vyos/vyos/plugins/modules/vyos_firewall_rules.py", line 1509, in main
  File "/tmp/ansible_vyos.vyos.vyos_firewall_rules_payload_1ensys4h/ansible_vyos.vyos.vyos_firewall_rules_payload.zip/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/config/firewall_rules/firewall_rules.py", line 87, in execute_module
  File "/tmp/ansible_vyos.vyos.vyos_firewall_rules_payload_1ensys4h/ansible_vyos.vyos.vyos_firewall_rules_payload.zip/ansible/module_utils/connection.py", line 195, in __rpc__
ansible.module_utils.connection.ConnectionError: commit failed: E-v6]] failed
[ firewall ipv6-name HOME-from-MAN-v6 ]
Firewall configuration error: Cannot delete rule set "HOME-from-MAN-v6" (still in use)



[[firewall ipv6-name HOME-from-MAN-v6]] failed
Commit failed
[edit]

[email protected]# 
fatal: [maccabeus01.hogs.tswn.us]: FAILED! => {
    "changed": false,
    "module_stderr": "Traceback (most recent call last):\n  File \"/home/sdwilsh/.ansible/tmp/ansible-local-565013_tnwu0sb/ansible-tmp-1629729912.218707-565503-246921439531834/AnsiballZ_vyos_firewall_rules.py\", line 102, in <module>\n    _ansiballz_main()\n  File \"/home/sdwilsh/.ansible/tmp/ansible-local-565013_tnwu0sb/ansible-tmp-1629729912.218707-565503-246921439531834/AnsiballZ_vyos_firewall_rules.py\", line 94, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n  File \"/home/sdwilsh/.ansible/tmp/ansible-local-565013_tnwu0sb/ansible-tmp-1629729912.218707-565503-246921439531834/AnsiballZ_vyos_firewall_rules.py\", line 40, in invoke_module\n    runpy.run_module(mod_name='ansible_collections.vyos.vyos.plugins.modules.vyos_firewall_rules', init_globals=None, run_name='__main__', alter_sys=True)\n  File \"/usr/lib/python3.8/runpy.py\", line 207, in run_module\n    return _run_module_code(code, init_globals, run_name, mod_spec)\n  File \"/usr/lib/python3.8/runpy.py\", line 97, in _run_module_code\n    _run_code(code, mod_globals, init_globals,\n  File \"/usr/lib/python3.8/runpy.py\", line 87, in _run_code\n    exec(code, run_globals)\n  File \"/tmp/ansible_vyos.vyos.vyos_firewall_rules_payload_1ensys4h/ansible_vyos.vyos.vyos_firewall_rules_payload.zip/ansible_collections/vyos/vyos/plugins/modules/vyos_firewall_rules.py\", line 1514, in <module>\n  File \"/tmp/ansible_vyos.vyos.vyos_firewall_rules_payload_1ensys4h/ansible_vyos.vyos.vyos_firewall_rules_payload.zip/ansible_collections/vyos/vyos/plugins/modules/vyos_firewall_rules.py\", line 1509, in main\n  File \"/tmp/ansible_vyos.vyos.vyos_firewall_rules_payload_1ensys4h/ansible_vyos.vyos.vyos_firewall_rules_payload.zip/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/config/firewall_rules/firewall_rules.py\", line 87, in execute_module\n  File \"/tmp/ansible_vyos.vyos.vyos_firewall_rules_payload_1ensys4h/ansible_vyos.vyos.vyos_firewall_rules_payload.zip/ansible/module_utils/connection.py\", line 195, in __rpc__\nansible.module_utils.connection.ConnectionError: commit failed: E-v6]] failed\r\n[ firewall ipv6-name HOME-from-MAN-v6 ]\r\nFirewall configuration error: Cannot delete rule set \"HOME-from-MAN-v6\" (still in use)\r\n\r\n\r\n\r\n[[firewall ipv6-name HOME-from-MAN-v6]] failed\r\nCommit failed\r\n[edit]\r\r\[email protected]# \n",
    "module_stdout": "",
    "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
    "rc": 1
}

dhcp does not appear to be an IPv4 or IPv6 address

SUMMARY

When trying to use vyos_l3_interfaces to set an ip address on an interface ansible crashes if an interface in vyos is set to use dhcp.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

vyos_l3_interfaces

ANSIBLE VERSION
ansible 2.11.0.dev0
  config file = None
  configured module search path = ['/home/centos/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/centos/.local/lib/python3.6/site-packages/ansible
  ansible collection location = /home/centos/.ansible/collections:/usr/share/ansible/collections
  executable location = /home/centos/.local/bin/ansible
  python version = 3.6.8 (default, Apr  2 2020, 13:34:55) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]
ansible 2.9.10
  config file = None
  configured module search path = [u'/Users/bshingler/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /Users/bshingler/Library/Python/2.7/lib/python/site-packages/ansible
  executable location = /Users/bshingler/Library/Python/2.7/bin/ansible
  python version = 2.7.16 (default, Apr 17 2020, 18:29:03) [GCC 4.2.1 Compatible Apple LLVM 11.0.3 (clang-1103.0.29.20) (-macos10.15-objc-
OS / ENVIRONMENT

Tried running on both macos catalina and centos 7, target was vyos 4.19.131-amd64-vyos #1 SMP Sun Jul 5 09:43:35 UTC 2020 x86_64

STEPS TO REPRODUCE

Have an interface in vyos with a dhcp address:
interfaces {
dummy dum1 {
}
ethernet eth1 {
address 192.168.222.207/24
address dhcp
mtu 1450
}
loopback lo {
}
}

---
- hosts: vyos
  tasks:
    - name: stick an ip on it
      vyos_l3_interfaces:
        config:
          - name: dum1
            ipv4:
                    - address: 192.168.1.1/24
EXPECTED RESULTS

Expected dum1 interface to be given the address 192.168.1.1/2

ACTUAL RESULTS

Ansible crashed with the following output

[WARNING]: You are running the development version of Ansible. You should only run Ansible from "devel" if you are modifying the Ansible engine, or trying out features under development. This is a
rapidly changing source of code and can become unstable at any point.
ansible-playbook 2.11.0.dev0
  config file = None
  configured module search path = ['/home/centos/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/centos/.local/lib/python3.6/site-packages/ansible
  ansible collection location = /home/centos/.ansible/collections:/usr/share/ansible/collections
  executable location = /home/centos/.local/bin/ansible-playbook
  python version = 3.6.8 (default, Apr  2 2020, 13:34:55) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]
No config file found; using defaults
host_list declined parsing /home/centos/vyosstuff/inventory as it did not pass its verify_file() method
script declined parsing /home/centos/vyosstuff/inventory as it did not pass its verify_file() method
auto declined parsing /home/centos/vyosstuff/inventory as it did not pass its verify_file() method
Parsed /home/centos/vyosstuff/inventory inventory source with ini plugin
redirecting (type: modules) ansible.builtin.vyos_l3_interfaces to vyos.vyos.vyos_l3_interfaces
[WARNING]: Collection vyos.vyos does not support Ansible version 2.11.0.dev0

PLAYBOOK: site.yml ***********************************************************************************************************************************************************************************
1 plays in site.yml

PLAY [vyos] ******************************************************************************************************************************************************************************************

TASK [Gathering Facts] *******************************************************************************************************************************************************************************
task path: /home/centos/vyosstuff/site.yml:2
redirecting (type: connection) ansible.builtin.network_cli to ansible.netcommon.network_cli
[WARNING]: Collection ansible.netcommon does not support Ansible version 2.11.0.dev0
redirecting (type: terminal) ansible.builtin.vyos to vyos.vyos.vyos
redirecting (type: cliconf) ansible.builtin.vyos to vyos.vyos.vyos
[WARNING]: Ignoring timeout(10) for vyos_facts
<172.25.4.135> ESTABLISH LOCAL CONNECTION FOR USER: centos
<172.25.4.135> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/centos/.ansible/tmp/ansible-local-22207waqzq0ag `"&& mkdir /home/centos/.ansible/tmp/ansible-local-22207waqzq0ag/ansible-tmp-1594724873.4162498-22214-39350126286664 && echo ansible-tmp-1594724873.4162498-22214-39350126286664="` echo /home/centos/.ansible/tmp/ansible-local-22207waqzq0ag/ansible-tmp-1594724873.4162498-22214-39350126286664 `" ) && sleep 0'
redirecting (type: modules) ansible.builtin.vyos_facts to vyos.vyos.vyos_facts
<vyos> Attempting python interpreter discovery
<172.25.4.135> EXEC /bin/sh -c 'echo PLATFORM; uname; echo FOUND; command -v '"'"'/usr/bin/python'"'"'; 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'
<172.25.4.135> EXEC /bin/sh -c '/usr/bin/python && sleep 0'
Using module file /home/centos/.ansible/collections/ansible_collections/vyos/vyos/plugins/modules/vyos_facts.py
<172.25.4.135> PUT /home/centos/.ansible/tmp/ansible-local-22207waqzq0ag/tmpxak_50_2 TO /home/centos/.ansible/tmp/ansible-local-22207waqzq0ag/ansible-tmp-1594724873.4162498-22214-39350126286664/AnsiballZ_vyos_facts.py
<172.25.4.135> EXEC /bin/sh -c 'chmod u+x /home/centos/.ansible/tmp/ansible-local-22207waqzq0ag/ansible-tmp-1594724873.4162498-22214-39350126286664/ /home/centos/.ansible/tmp/ansible-local-22207waqzq0ag/ansible-tmp-1594724873.4162498-22214-39350126286664/AnsiballZ_vyos_facts.py && sleep 0'
<172.25.4.135> EXEC /bin/sh -c '/usr/bin/python /home/centos/.ansible/tmp/ansible-local-22207waqzq0ag/ansible-tmp-1594724873.4162498-22214-39350126286664/AnsiballZ_vyos_facts.py && sleep 0'
<172.25.4.135> EXEC /bin/sh -c 'rm -f -r /home/centos/.ansible/tmp/ansible-local-22207waqzq0ag/ansible-tmp-1594724873.4162498-22214-39350126286664/ > /dev/null 2>&1 && sleep 0'
ok: [vyos]
META: ran handlers

TASK [stick an ip on it] *****************************************************************************************************************************************************************************
task path: /home/centos/vyosstuff/site.yml:4
redirecting (type: connection) ansible.builtin.network_cli to ansible.netcommon.network_cli
[WARNING]: Collection ansible.netcommon does not support Ansible version 2.11.0.dev0
redirecting (type: terminal) ansible.builtin.vyos to vyos.vyos.vyos
redirecting (type: cliconf) ansible.builtin.vyos to vyos.vyos.vyos
redirecting (type: action) ansible.builtin.vyos to vyos.vyos.vyos
redirecting (type: action) ansible.builtin.vyos to vyos.vyos.vyos
<172.25.4.135> ESTABLISH LOCAL CONNECTION FOR USER: centos
<172.25.4.135> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/centos/.ansible/tmp/ansible-local-22207waqzq0ag `"&& mkdir /home/centos/.ansible/tmp/ansible-local-22207waqzq0ag/ansible-tmp-1594724879.4941103-22250-267290698915974 && echo ansible-tmp-1594724879.4941103-22250-267290698915974="` echo /home/centos/.ansible/tmp/ansible-local-22207waqzq0ag/ansible-tmp-1594724879.4941103-22250-267290698915974 `" ) && sleep 0'
redirecting (type: modules) ansible.builtin.vyos_l3_interfaces to vyos.vyos.vyos_l3_interfaces
Using module file /home/centos/.ansible/collections/ansible_collections/vyos/vyos/plugins/modules/vyos_l3_interfaces.py
<172.25.4.135> PUT /home/centos/.ansible/tmp/ansible-local-22207waqzq0ag/tmp2l6vd14_ TO /home/centos/.ansible/tmp/ansible-local-22207waqzq0ag/ansible-tmp-1594724879.4941103-22250-267290698915974/AnsiballZ_vyos_l3_interfaces.py
<172.25.4.135> EXEC /bin/sh -c 'chmod u+x /home/centos/.ansible/tmp/ansible-local-22207waqzq0ag/ansible-tmp-1594724879.4941103-22250-267290698915974/ /home/centos/.ansible/tmp/ansible-local-22207waqzq0ag/ansible-tmp-1594724879.4941103-22250-267290698915974/AnsiballZ_vyos_l3_interfaces.py && sleep 0'
<172.25.4.135> EXEC /bin/sh -c '/usr/bin/python /home/centos/.ansible/tmp/ansible-local-22207waqzq0ag/ansible-tmp-1594724879.4941103-22250-267290698915974/AnsiballZ_vyos_l3_interfaces.py && sleep 0'
<172.25.4.135> EXEC /bin/sh -c 'rm -f -r /home/centos/.ansible/tmp/ansible-local-22207waqzq0ag/ansible-tmp-1594724879.4941103-22250-267290698915974/ > /dev/null 2>&1 && sleep 0'
The full traceback is:
Traceback (most recent call last):
  File "/home/centos/.ansible/tmp/ansible-local-22207waqzq0ag/ansible-tmp-1594724879.4941103-22250-267290698915974/AnsiballZ_vyos_l3_interfaces.py", line 102, in <module>
    _ansiballz_main()
  File "/home/centos/.ansible/tmp/ansible-local-22207waqzq0ag/ansible-tmp-1594724879.4941103-22250-267290698915974/AnsiballZ_vyos_l3_interfaces.py", line 94, in _ansiballz_main
    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
  File "/home/centos/.ansible/tmp/ansible-local-22207waqzq0ag/ansible-tmp-1594724879.4941103-22250-267290698915974/AnsiballZ_vyos_l3_interfaces.py", line 40, in invoke_module
    runpy.run_module(mod_name='ansible_collections.vyos.vyos.plugins.modules.vyos_l3_interfaces', init_globals=None, run_name='__main__', alter_sys=True)
  File "/usr/lib64/python2.7/runpy.py", line 176, in run_module
    fname, loader, pkg_name)
  File "/usr/lib64/python2.7/runpy.py", line 82, in _run_module_code
    mod_name, mod_fname, mod_loader, pkg_name)
  File "/usr/lib64/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/tmp/ansible_vyos_l3_interfaces_payload_ZAxoHw/ansible_vyos_l3_interfaces_payload.zip/ansible_collections/vyos/vyos/plugins/modules/vyos_l3_interfaces.py", line 575, in <module>
  File "/tmp/ansible_vyos_l3_interfaces_payload_ZAxoHw/ansible_vyos_l3_interfaces_payload.zip/ansible_collections/vyos/vyos/plugins/modules/vyos_l3_interfaces.py", line 570, in main
  File "/tmp/ansible_vyos_l3_interfaces_payload_ZAxoHw/ansible_vyos_l3_interfaces_payload.zip/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/config/l3_interfaces/l3_interfaces.py", line 82, in execute_module
  File "/tmp/ansible_vyos_l3_interfaces_payload_ZAxoHw/ansible_vyos_l3_interfaces_payload.zip/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/config/l3_interfaces/l3_interfaces.py", line 62, in get_l3_interfaces_facts
  File "/tmp/ansible_vyos_l3_interfaces_payload_ZAxoHw/ansible_vyos_l3_interfaces_payload.zip/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/facts/facts.py", line 94, in get_facts
  File "/tmp/ansible_vyos_l3_interfaces_payload_ZAxoHw/ansible_vyos_l3_interfaces_payload.zip/ansible_collections/ansible/netcommon/plugins/module_utils/network/common/facts/facts.py", line 128, in get_network_resources_facts
  File "/tmp/ansible_vyos_l3_interfaces_payload_ZAxoHw/ansible_vyos_l3_interfaces_payload.zip/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/facts/l3_interfaces/l3_interfaces.py", line 72, in populate_facts
  File "/tmp/ansible_vyos_l3_interfaces_payload_ZAxoHw/ansible_vyos_l3_interfaces_payload.zip/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/facts/l3_interfaces/l3_interfaces.py", line 100, in render_config
  File "/tmp/ansible_vyos_l3_interfaces_payload_ZAxoHw/ansible_vyos_l3_interfaces_payload.zip/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/facts/l3_interfaces/l3_interfaces.py", line 133, in parse_attribs
  File "/tmp/ansible_vyos_l3_interfaces_payload_ZAxoHw/ansible_vyos_l3_interfaces_payload.zip/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/utils/utils.py", line 218, in get_ip_address_version
  File "/tmp/ansible_vyos_l3_interfaces_payload_ZAxoHw/ansible_vyos_l3_interfaces_payload.zip/ansible_collections/ansible/netcommon/plugins/module_utils/compat/ipaddress.py", line 236, in ip_address
    raise ValueError('%r does not appear to be an IPv4 or IPv6 interface' %
ValueError: u"dhcp'\x1b[m" does not appear to be an IPv4 or IPv6 address
fatal: [vyos]: FAILED! => {
    "changed": false,
    "module_stderr": "Traceback (most recent call last):\n  File \"/home/centos/.ansible/tmp/ansible-local-22207waqzq0ag/ansible-tmp-1594724879.4941103-22250-267290698915974/AnsiballZ_vyos_l3_interfaces.py\", line 102, in <module>\n    _ansiballz_main()\n  File \"/home/centos/.ansible/tmp/ansible-local-22207waqzq0ag/ansible-tmp-1594724879.4941103-22250-267290698915974/AnsiballZ_vyos_l3_interfaces.py\", line 94, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n  File \"/home/centos/.ansible/tmp/ansible-local-22207waqzq0ag/ansible-tmp-1594724879.4941103-22250-267290698915974/AnsiballZ_vyos_l3_interfaces.py\", line 40, in invoke_module\n    runpy.run_module(mod_name='ansible_collections.vyos.vyos.plugins.modules.vyos_l3_interfaces', init_globals=None, run_name='__main__', alter_sys=True)\n  File \"/usr/lib64/python2.7/runpy.py\", line 176, in run_module\n    fname, loader, pkg_name)\n  File \"/usr/lib64/python2.7/runpy.py\", line 82, in _run_module_code\n    mod_name, mod_fname, mod_loader, pkg_name)\n  File \"/usr/lib64/python2.7/runpy.py\", line 72, in _run_code\n    exec code in run_globals\n  File \"/tmp/ansible_vyos_l3_interfaces_payload_ZAxoHw/ansible_vyos_l3_interfaces_payload.zip/ansible_collections/vyos/vyos/plugins/modules/vyos_l3_interfaces.py\", line 575, in <module>\n  File \"/tmp/ansible_vyos_l3_interfaces_payload_ZAxoHw/ansible_vyos_l3_interfaces_payload.zip/ansible_collections/vyos/vyos/plugins/modules/vyos_l3_interfaces.py\", line 570, in main\n  File \"/tmp/ansible_vyos_l3_interfaces_payload_ZAxoHw/ansible_vyos_l3_interfaces_payload.zip/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/config/l3_interfaces/l3_interfaces.py\", line 82, in execute_module\n  File \"/tmp/ansible_vyos_l3_interfaces_payload_ZAxoHw/ansible_vyos_l3_interfaces_payload.zip/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/config/l3_interfaces/l3_interfaces.py\", line 62, in get_l3_interfaces_facts\n  File \"/tmp/ansible_vyos_l3_interfaces_payload_ZAxoHw/ansible_vyos_l3_interfaces_payload.zip/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/facts/facts.py\", line 94, in get_facts\n  File \"/tmp/ansible_vyos_l3_interfaces_payload_ZAxoHw/ansible_vyos_l3_interfaces_payload.zip/ansible_collections/ansible/netcommon/plugins/module_utils/network/common/facts/facts.py\", line 128, in get_network_resources_facts\n  File \"/tmp/ansible_vyos_l3_interfaces_payload_ZAxoHw/ansible_vyos_l3_interfaces_payload.zip/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/facts/l3_interfaces/l3_interfaces.py\", line 72, in populate_facts\n  File \"/tmp/ansible_vyos_l3_interfaces_payload_ZAxoHw/ansible_vyos_l3_interfaces_payload.zip/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/facts/l3_interfaces/l3_interfaces.py\", line 100, in render_config\n  File \"/tmp/ansible_vyos_l3_interfaces_payload_ZAxoHw/ansible_vyos_l3_interfaces_payload.zip/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/facts/l3_interfaces/l3_interfaces.py\", line 133, in parse_attribs\n  File \"/tmp/ansible_vyos_l3_interfaces_payload_ZAxoHw/ansible_vyos_l3_interfaces_payload.zip/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/utils/utils.py\", line 218, in get_ip_address_version\n  File \"/tmp/ansible_vyos_l3_interfaces_payload_ZAxoHw/ansible_vyos_l3_interfaces_payload.zip/ansible_collections/ansible/netcommon/plugins/module_utils/compat/ipaddress.py\", line 236, in ip_address\n    raise ValueError('%r does not appear to be an IPv4 or IPv6 interface' %\nValueError: u\"dhcp'\\x1b[m\" does not appear to be an IPv4 or IPv6 address\n",
    "module_stdout": "",
    "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
    "rc": 1
}

Private argument spec validation methods no longer available in Ansible Core 2.11

SUMMARY

Argument spec validation has changed in Ansible Core 2.11. The following private method calls should be changed to use the public interface:

collections/vyos.vyos/plugins/modules/vyos_logging.py
259:            module._check_required_if(required_if, item)  # --> ansible.module_utils.common.validation.check_required_if()

collections/vyos.vyos/plugins/modules/vyos_static_route.py
241:            module._check_required_together(required_together, item)  # --> ansible.module_utils.common.validation.check_required_together()
ISSUE TYPE
  • Bug Report
COMPONENT NAME

vyos.vyos/plugins/modules/vyos_logging.py
/vyos.vyos/plugins/modules/vyos_static_route.py

ANSIBLE VERSION
2.11

Missing files

SUMMARY

In https://github.com/ansible/ansible/tree/stable-2.9/lib/ansible/plugins/terminal, there was a file called cnos.py, but on the devel branch they aren't present anymore, as you can see: https://github.com/ansible/ansible/tree/devel/lib/ansible/plugins.
Next to the "terminal" folder it says "Migrated to vyos.vyos" and no file can be found in that folder anymore. If you click on that you find this submit ansible/ansible#68282 which deleted many files in the project.
I guess this is the new repository the file should be in (https://github.com/ansible-collections/vyos/), but I'm unable to find it. Nor any of the other files in this folder..

And also, I can't find the files in
https://github.com/ansible/ansible/tree/stable-2.9/lib/ansible/modules/network/cnos
Were they supposed to be moved under https://github.com/ansible-collections/ ? because I don't see the cnos folder.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

modules/network/cnos
terminal plugin

KeyError: 'source' - vyos_firewall_rules

SUMMARY

Ansible run fails with python error KeyError: 'source' from file firewall_rules.py when trying to replace/merge/override rule with the existing number which contains address_group

ISSUE TYPE
  • Bug Report
COMPONENT NAME

vyos_firewall_rules

ANSIBLE VERSION
❯ ansible --version
ansible 2.10.7
  config file = None
  configured module search path = ['/Users/filda/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /opt/homebrew/Cellar/ansible/3.2.0/libexec/lib/python3.9/site-packages/ansible
  executable location = /opt/homebrew/bin/ansible
  python version = 3.9.4 (default, Apr  4 2021, 17:42:23) [Clang 12.0.0 (clang-1200.0.32.29)]
CONFIGURATION

OS / ENVIRONMENT

Version: VyOS 1.4-rolling-202104091411
Release Train: sagitta

Built by: [email protected]
Built on: Fri 09 Apr 2021 12:16 UTC
Build UUID: 2036e80c-34a1-4429-9f35-1869cca76500
Build Commit ID: b3ba57ac9423a9

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: 3f026c93-de24-4bfc-9476-42157a49e281

Copyright: VyOS maintainers and contributors

STEPS TO REPRODUCE

set firewall group address-group inbound

Before:

"afi": "ipv4",
"rule_sets": [
    {
        "default_action": "drop",
        "description": "Communication from WAN to GW",
        "name": "WAN-GW",
        "rules": [
            {
                "action": "accept",
                "description": "Accept already established connections",
                "number": 1,
                "state": {
                    "established": true,
                    "related": true
                }
            },
            {
                "action": "accept",
                "description": "Accept router keepalive",
                "destination": {
                    "port": "694"
                },
                "number": 2,
                "protocol": "udp",
                "source": {
                    "group": {
                        "address_group": "inbound"
                    }
                }
            },
            {
                "action": "accept",
                "description": "Accept wireguard connection",
                "destination": {
                    "port": "51820"
                },
                "number": 3,
                "protocol": "udp"
            }
        ]
    }
]
- name: Setting firewall rules
  vyos.vyos.vyos_firewall_rules:
    config:
      - afi: ipv4
        rule_sets:
        - name: WAN-GW
          description: Communication from WAN to GW
          default_action: drop
          rules:
            - description: Accept routers keepalive
              action: accept
              number: 3
              protocol: udp
              source:
                group:
                  address_group: inbound
              destination:
                port: 694
    state: overridden
EXPECTED RESULTS
  1. Delete all exists rules
    delete firewall name WAN-GW rule 1
    delete firewall name WAN-GW rule 2
    delete firewall name WAN-GW rule 3

  2. Set new rule
    set firewall name WAN-GW rule 3 description "Accept routers keepalive"
    set firewall name WAN-GW rule 3 action "accept"
    set firewall name WAN-GW rule 3 protocol "udp"
    set firewall name WAN-GW rule 3 source group address-group inbound
    set firewall name WAN-GW rule 3 destination port 694

ACTUAL RESULTS
The full traceback is:
Traceback (most recent call last):
  File "/Users/filda/.ansible/tmp/ansible-local-7537zjs6ond4/ansible-tmp-1618097726.128984-7540-259370164945433/AnsiballZ_vyos_firewall_rules.py", line 102, in <module>
    _ansiballz_main()
  File "/Users/filda/.ansible/tmp/ansible-local-7537zjs6ond4/ansible-tmp-1618097726.128984-7540-259370164945433/AnsiballZ_vyos_firewall_rules.py", line 94, in _ansiballz_main
    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
  File "/Users/filda/.ansible/tmp/ansible-local-7537zjs6ond4/ansible-tmp-1618097726.128984-7540-259370164945433/AnsiballZ_vyos_firewall_rules.py", line 40, in invoke_module
    runpy.run_module(mod_name='ansible_collections.vyos.vyos.plugins.modules.vyos_firewall_rules', init_globals=None, run_name='__main__', alter_sys=True)
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/runpy.py", line 206, in run_module
    return _run_module_code(code, init_globals, run_name, mod_spec)
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/runpy.py", line 96, in _run_module_code
    _run_code(code, mod_globals, init_globals,
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/var/folders/vf/989g0tvn0sdfqw7fm1zt2tlm0000gn/T/ansible_vyos.vyos.vyos_firewall_rules_payload_jm89wt3j/ansible_vyos.vyos.vyos_firewall_rules_payload.zip/ansible_collections/vyos/vyos/plugins/modules/vyos_firewall_rules.py", line 1514, in <module>
  File "/var/folders/vf/989g0tvn0sdfqw7fm1zt2tlm0000gn/T/ansible_vyos.vyos.vyos_firewall_rules_payload_jm89wt3j/ansible_vyos.vyos.vyos_firewall_rules_payload.zip/ansible_collections/vyos/vyos/plugins/modules/vyos_firewall_rules.py", line 1509, in main
  File "/var/folders/vf/989g0tvn0sdfqw7fm1zt2tlm0000gn/T/ansible_vyos.vyos.vyos_firewall_rules_payload_jm89wt3j/ansible_vyos.vyos.vyos_firewall_rules_payload.zip/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/config/firewall_rules/firewall_rules.py", line 83, in execute_module
  File "/var/folders/vf/989g0tvn0sdfqw7fm1zt2tlm0000gn/T/ansible_vyos.vyos.vyos_firewall_rules_payload_jm89wt3j/ansible_vyos.vyos.vyos_firewall_rules_payload.zip/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/config/firewall_rules/firewall_rules.py", line 129, in set_config
  File "/var/folders/vf/989g0tvn0sdfqw7fm1zt2tlm0000gn/T/ansible_vyos.vyos.vyos_firewall_rules_payload_jm89wt3j/ansible_vyos.vyos.vyos_firewall_rules_payload.zip/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/config/firewall_rules/firewall_rules.py", line 159, in set_state
  File "/var/folders/vf/989g0tvn0sdfqw7fm1zt2tlm0000gn/T/ansible_vyos.vyos.vyos_firewall_rules_payload_jm89wt3j/ansible_vyos.vyos.vyos_firewall_rules_payload.zip/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/config/firewall_rules/firewall_rules.py", line 177, in _state_replaced
  File "/var/folders/vf/989g0tvn0sdfqw7fm1zt2tlm0000gn/T/ansible_vyos.vyos.vyos_firewall_rules_payload_jm89wt3j/ansible_vyos.vyos.vyos_firewall_rules_payload.zip/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/config/firewall_rules/firewall_rules.py", line 218, in _state_merged
  File "/var/folders/vf/989g0tvn0sdfqw7fm1zt2tlm0000gn/T/ansible_vyos.vyos.vyos_firewall_rules_payload_jm89wt3j/ansible_vyos.vyos.vyos_firewall_rules_payload.zip/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/config/firewall_rules/firewall_rules.py", line 318, in _add_r_sets
  File "/var/folders/vf/989g0tvn0sdfqw7fm1zt2tlm0000gn/T/ansible_vyos.vyos.vyos_firewall_rules_payload_jm89wt3j/ansible_vyos.vyos.vyos_firewall_rules_payload.zip/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/config/firewall_rules/firewall_rules.py", line 426, in _add_rules
  File "/var/folders/vf/989g0tvn0sdfqw7fm1zt2tlm0000gn/T/ansible_vyos.vyos.vyos_firewall_rules_payload_jm89wt3j/ansible_vyos.vyos.vyos_firewall_rules_payload.zip/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/config/firewall_rules/firewall_rules.py", line 782, in _add_src_or_dest
KeyError: 'source'

Support VyOS 1.4 in vyos_bgp_global

SUMMARY

Add support for VyOS 1.4 BGP configuration

VyOS 1.3 (Equuleus) example:

set protocols bgp 65534 neighbor 192.168.0.2 ebgp-multihop '2'
set protocols bgp 65534 neighbor 192.168.0.2 remote-as '65535'
set protocols bgp 65534 neighbor 192.168.0.2 update-source '192.168.0.1'
set protocols bgp 65534 address-family ipv4-unicast network '172.16.0.0/16'
set protocols bgp 65534 parameters router-id '192.168.0.1'

VyOS 1.4 (sagitta) example:

set protocols bgp local-as 65534
set protocols bgp neighbor 192.168.0.2 ebgp-multihop '2'
set protocols bgp neighbor 192.168.0.2 remote-as '65535'
set protocols bgp neighbor 192.168.0.2 update-source '192.168.0.1'
set protocols bgp address-family ipv4-unicast network '172.16.0.0/16'
set protocols bgp parameters router-id '192.168.0.1'
ISSUE TYPE
  • Feature Idea
COMPONENT NAME

vyos_bgp_global

ADDITIONAL INFORMATION

[vyos_config] Remove statements not in config

SUMMARY

When providing config in brace style it's translated to only 'set' statements. It's then just merged with existing config, but statements not in provided config are not deleted.
It could be good to have option to load fresh full config and delete everything else. Just like Vyos 'load' command do.

Maybe something like 'state: merge [default] or replaced' as can be found in other modules?

ISSUE TYPE
  • Feature Idea
COMPONENT NAME

vyos_config

ADDITIONAL INFORMATION

We build full config using templates, then send to device to replace old config with new one. Right now we just copy this config and issue 'load' command, but using proper module with diff and report what was really send to device would be definitely more proper way of doing this.

Add support for wireguard interface

SUMMARY

Add support for parsing wireguard interface like wg01 in vyos.vyos.vyos_interfaces parameter name

ISSUE TYPE
  • Feature Idea
COMPONENT NAME

vyos.vyos.vyos_interfaces

ADDITIONAL INFORMATION

Better and much easier managing wireguard interfaces, state option using vyos_interfaces.
The main problem with using vyos.vyos.vyos_config is missing the state option and it's needed to make advanced when conditions for setup peers. Also, vyos_config is every time in the changed state

FROM
- name: Setup wireguard interface wg01
  vyos.vyos.vyos_config:
    lines:
    - set interfaces wireguard wg01 description WGTunnel
    - set interfaces wireguard wg01 port 51820
    - set interfaces wireguard wg01 address 172.31.0.1/24
    
- name: Adding wireguard users for wg01
  vyos.vyos.vyos_config:
    lines:
    - set interfaces wireguard wg01 peer TestTunnel allowed-ips 172.31.0.2/32
    - set interfaces wireguard wg01 peer TestTunnel pubkey xxxxxxxxx

TO (example)
- name: setup wg01
  vyos.vyos.vyos_interfaces:
    config:
    - name: wg01
      description: Configured by Ansible
      enabled: true
      port: 51820
      address: 172.31.0.1/24
      peer:
        - name: TestTunnel
          allowed_ips: 172.31.0.2/32
          pubkey: xxxxxxxxx

[vyos_ntp_global] `dynamic` isn't a valid vyos option for a server, and `pool` is missing

SUMMARY

#175 added vyos_ntp_global, which allows setting options on servers. Per the documentation, those options are noselect, dynamic, preempt, and prefer. However, documentation for equuleus and dev do not have dynamic, but instead pool (crux documentation is lacking clarity). dynamic is not a supported option for vyos, so it's impossible to set a pool with this module.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

vyos.vyos.vyos_ntp_global

STEPS TO REPRODUCE
    - vyos.vyos.vyos_ntp_global:
        config:
          servers:
            - server: "0.pool.ntp.org"
              options:
                - "dynamic"
EXPECTED RESULTS

All documented options to work, and all options to be allowed for a server. I would find it acceptable if dynamic maps to pool if this module is trying to maintain compatibility with out networking modules, but that should be documented as well.

ACTUAL RESULTS

If you use the above example, you get an error (tested on equuleus):

Configuration path: system ntp server 0.pool.ntp.org [dynamic] is not valid

If you try to manually specify pool an an option, you get an error:

value of options must be one or more of: noselect, dynamic, preempt, prefer. Got no match for: pool found in config -> servers

Inclusion of vyos.vyos in Ansible 2.10

This collection will be included in Ansible 2.10 because it contains modules and/or plugins that were included in Ansible 2.9. Please review:

DEADLINE: 2020-08-18

The latest version of the collection available on August 18 will be included in Ansible 2.10.0, except possibly newer versions which differ only in the patch level. (For details, see the roadmap). Please release version 1.0.0 of your collection by this date! If 1.0.0 does not exist, the same 0.x.y version will be used in all of Ansible 2.10 without updates, and your 1.x.y release will not be included until Ansible 2.11 (unless you request an exception at a community working group meeting and go through a demanding manual process to vouch for backwards compatibility . . . you want to avoid this!).

Follow semantic versioning rules

Your collection versioning must follow all semver rules. This means:

  • Patch level releases can only contain bugfixes;
  • Minor releases can contain new features, new modules and plugins, and bugfixes, but must not break backwards compatibility;
  • Major releases can break backwards compatibility.

Changelogs and Porting Guide

Your collection should provide data for the Ansible 2.10 changelog and porting guide. The changelog and porting guide are automatically generated from ansible-base, and from the changelogs of the included collections. All changes from the breaking_changes, major_changes, removed_features and deprecated_features sections will appear in both the changelog and the porting guide. You have two options for providing changelog fragments to include:

  1. If possible, use the antsibull-changelog tool, which uses the same changelog fragment as the ansible/ansible repository (see the documentation).
  2. If you cannot use antsibull-changelog, you can provide the changelog in a machine-readable format as changelogs/changelog.yaml inside your collection (see the documentation of changelogs/changelog.yaml format).

If you cannot contribute to the integrated Ansible changelog using one of these methods, please provide a link to your collection's changelog by creating an issue in https://github.com/ansible-community/ansible-build-data/. If you do not provide changelogs/changelog.yml or a link, users will not be able to find out what changed in your collection from the Ansible changelog and porting guide.

Make sure your collection passes the sanity tests

Run ansible-test sanity --docker -v in the collection with the latest ansible-base or stable-2.10 ansible/ansible checkout.

Keep informed

Be sure you're subscribed to:

Questions and Feedback

If you have questions or want to provide feedback, please see the Feedback section in the collection requirements.

(Internal link to keep track of issues: ansible-collections/overview#102)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.