Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions changelogs/fragments/netbox_service.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- netbox_service - Fix issue #1426 / broken netbox_service module

Check failure on line 2 in changelogs/fragments/netbox_service.yml

View workflow job for this annotation

GitHub Actions / ansible-lint / Ansible Lint

yaml[comments]

Missing starting space in comment
12 changes: 12 additions & 0 deletions plugins/module_utils/netbox_ipam.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ def run(self):
- vlans
- vlan_groups
- vrfs
- services
- service_template
"""
# Used to dynamically set key when returning results
endpoint_name = ENDPOINT_NAME_MAPPING[self.endpoint]
Expand Down Expand Up @@ -214,6 +216,16 @@ def run(self):
if not data.get("slug"):
data["slug"] = self._to_slug(name)

if self.endpoint == "services":
if "device" in data:
data["parent_object_type"] = "dcim.device"
data["parent_object_id"] = data["device"]
del data["device"]
elif "virtual_machine" in data:
data["parent_object_type"] = "virtualization.virtualmachine"
data["parent_object_id"] = data["virtual_machine"]
del data["virtual_machine"]

if self.module.params.get("first_available"):
first_available = True
else:
Expand Down
Loading