netbox-community / ansible_modules

NetBox modules for Ansible using Ansible Collections
GNU General Public License v3.0
330 stars 211 forks source link

[Feature]: Add a VRF option to netbox_virtual_machine module that can be used for primary_ip #1201

Open rog9876 opened 6 months ago

rog9876 commented 6 months ago

NetBox version

v3.4.0

Feature type

Change to existing Module

Proposed functionality

Add VRF option that can be used in the netbox_virtual_machine module, so we can specify an IP for primary_ipv4 in a specific VRF.

Use case

We have multiple VRFs with the same ranges and VMs can have the same IP as long as they are in separate VRFs. However, primary_ipv4 now throws the error "msg": "More than one result returned for primary_ip4"

If it was VRF-specific, it would only find one.

External dependencies

No response

rog9876 commented 6 months ago

Just to add - We now found a workaround for this by using the ID for the IP e.g:

primary_ip4: 
        address: 172.16.0.3/27
        id: 101407

This is not mentioned on the Ansible documentation page here: https://docs.ansible.com/ansible/latest/collections/netbox/netbox/netbox_virtual_machine_module.html