Skip to content

Commit 5b453cf

Browse files
authored
Add parent_inventory_item to module netbox_inventory_item (#682)
1 parent 6adc81a commit 5b453cf

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

plugins/module_utils/netbox_utils.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@
202202
"parent_contact_group": "contact_groups",
203203
"parent_location": "locations",
204204
"parent_interface": "interfaces",
205+
"parent_inventory_item": "inventory_items",
205206
"parent_vm_interface": "interfaces",
206207
"parent_region": "regions",
207208
"parent_site_group": "site_groups",
@@ -383,6 +384,7 @@
383384
"parent_contact_group": set(["name"]),
384385
"parent_location": set(["slug"]),
385386
"parent_interface": set(["name"]),
387+
"parent_inventory_item": set(["name", "device"]),
386388
"parent_vm_interface": set(["name"]),
387389
"parent_region": set(["slug"]),
388390
"parent_site_group": set(["slug"]),
@@ -486,6 +488,7 @@
486488
"parent_contact_group": "parent",
487489
"parent_location": "parent",
488490
"parent_interface": "parent",
491+
"parent_inventory_item": "parent",
489492
"parent_vm_interface": "parent",
490493
"parent_region": "parent",
491494
"parent_site_group": "parent",

plugins/modules/netbox_inventory_item.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,6 @@
77

88
__metaclass__ = type
99

10-
ANSIBLE_METADATA = {
11-
"metadata_version": "1.1",
12-
"status": ["preview"],
13-
"supported_by": "community",
14-
}
15-
1610
DOCUMENTATION = r"""
1711
---
1812
module: netbox_inventory_item
@@ -45,6 +39,12 @@
4539
- Name of the inventory item to be created
4640
required: true
4741
type: str
42+
parent_inventory_item:
43+
description:
44+
- The parent inventory item the inventory item will be associated with
45+
required: false
46+
type: raw
47+
version_added: "3.5.0"
4848
label:
4949
description:
5050
- The physical label of the inventory item
@@ -171,6 +171,7 @@ def main():
171171
options=dict(
172172
device=dict(required=False, type="raw"),
173173
name=dict(required=True, type="str"),
174+
parent_inventory_item=dict(required=False, type="raw"),
174175
label=dict(required=False, type="str"),
175176
manufacturer=dict(required=False, type="raw"),
176177
part_id=dict(required=False, type="str"),

0 commit comments

Comments
 (0)