ansible-collections / community.general

Ansible Community General Collection
https://galaxy.ansible.com/ui/repo/published/community/general/
GNU General Public License v3.0
814 stars 1.49k forks source link

nmcli support for vrf #8014

Open cbutera-sqsp opened 6 months ago

cbutera-sqsp commented 6 months ago

Summary

The nmcli module does not support vrf creation. Two commands are required to create a vrf and then place an interface in one. The command to create the vrf fails due to table and type vrf not being supported. CLI command example ansible task example and errors below

nmcli connection add con-name mgmt type vrf ifname mgmt table 10 ipv4.method disabled ipv6.method disabled

- name: create mgmt vrf
  community.general.nmcli:
    type: vrf
    ifname: mgmt
    table: 10
    state: present
    conn_name: mgmt

Unsupported parameters for (community.general.nmcli) module: table

FAILED! => {"changed": false, "msg": "value of type must be one of: bond, bond-slave, bridge, bridge-slave, dummy, ethernet, generic, gre, infiniband, ipip, sit, team, team-slave, vlan, vxlan, wifi, gsm, macvlan, wireguard, vpn, loopback, got: vrf"}

The second command to configure the interface and place it in the vrf fails due to the slave_type vrf not being supported. CLI command example ansible task example and errors below

nmcli connection add con-name eth0 ifname eth0 type ethernet ip4 192.168.1.2/24 gw4 192.168.1.1

- name: Add mgmt_iface connection
  become: true
  community.general.nmcli:
    type: ethernet
    conn_name: "{{ mgmt_iface }}"
    ifname: "{{ mgmt_iface }}"
    master: mgmt
    slave_type: vrf
    state: present
    ip4: "{{ mgmt_ipaddr1 }}/24"
    gw4: "{{ mgmt_ipaddr1 | ipsubnet(24) | ipaddr('1') | ipaddr('address') }}"

FAILED! => {"changed": false, "msg": "value of slave_type must be one of: bond, bridge, team, got: vrf"}

Issue Type

Feature Idea

Component Name

nmcli

Additional Information

Code of Conduct

ansibullbot commented 6 months ago

Files identified in the description:

If these files are incorrect, please update the component name section of the description or use the !component bot command.

click here for bot help

ansibullbot commented 6 months ago

cc @alcamie101 click here for bot help