netbox-community / ansible_modules

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

[Feature]: Add vm assigned device to inventory vars #852

Open fprina opened 1 year ago

fprina commented 1 year ago

NetBox version

v3.3.5

Feature type

Change to existing Module

Proposed functionality

In the inventory variables related to a virtual machine should be present the assigned device

According to the web interface restrictions I suppose the right var name is cluster_device

For esample vm1 in the demo site is assigned to a specific device so ansible-inventory --host vm1 should return:

{ "cluster": "DO-AMS3", "cluster_device": "NCblade[0-3]" "cluster_group": "emea", "cluster_type": "digitalocean", "custom_fields": {}, "device_roles": [ "application-server" ], "is_virtual": true, "local_context_data": [ null ], "locations": [], "platforms": [ "ubuntu-linux-20-04" ], "regions": [], "services": [], "site_groups": [], "status": { "label": "Active", "value": "active" }, "tags": [] }

Use case

use the assigned device directly in the ansible playbooks

External dependencies

No response

joek-office commented 7 months ago

Nice enhancement request, is anyone out there working on this?