Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing elements to netbox_fhrp_group #1348

Open
wants to merge 9 commits into
base: devel
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
3 changes: 3 additions & 0 deletions changelogs/fragments/1349-add-additional-fhrp-arguments.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
minor_changes:
- in netbox_ip_address added assigned_object_type and assigned_object_id options
- In the netbox_fhrp_group, the `name` parameter is now required, which is used to search.
2 changes: 1 addition & 1 deletion plugins/module_utils/netbox_ipam.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ def run(self):
elif self.endpoint == "asns":
name = data.get("asn")
elif self.endpoint == "fhrp_groups":
name = data.get("group_id")
name = data.get("name")
elif self.endpoint == "fhrp_group_assignments":
name = "fhrp_group %s > %s %s" % (
data.get("group"),
Expand Down
4 changes: 2 additions & 2 deletions plugins/module_utils/netbox_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@
device_type="slug",
export_targets="name",
export_template="name",
fhrp_groups="group_id",
fhrp_groups="name",
fhrp_group_assignments="id",
group="slug",
groups="name",
Expand Down Expand Up @@ -493,7 +493,7 @@
"device_type": set(["slug"]),
"export_template": set(["name"]),
"fhrp_group": set(
["id", "group_id", "interface_type", "device", "virtual_machine"]
["id", "group_id","name", "interface_type", "device", "virtual_machine"]
),
"fhrp_group_assignment": set(["group", "interface_type", "interface_id"]),
"front_port": set(["name", "device", "rear_port"]),
Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/netbox_fhrp_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def main():
type="dict",
required=True,
options=dict(
name=dict(type="str"),
name=dict(type="str", required=True),
protocol=dict(
type="str",
choices=[
Expand Down
22 changes: 22 additions & 0 deletions plugins/modules/netbox_ip_address.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,16 @@
- Hostname or FQDN
required: false
type: str
assigned_object_id:
description:
- ID of the assigned object
type: str
required: false
assigned_object_type:
description:
- Type of the assigned object
type: str
required: false
assigned_object:
description:
- Definition of the assigned object.
Expand Down Expand Up @@ -264,6 +274,16 @@
name: GigabitEthernet1
device: test100
state: new

- name: Create an IP address using NetBox and add it to the FHRP group
netbox.netbox.netbox_ip_address:
netbox_url: http://netbox.local
netbox_token: thisIsMyToken
data:
address: 192.168.1.10
assigned_object_id: 30
assigned_object_type: "ipam.fhrpgroup"
state: present
"""

RETURN = r"""
Expand Down Expand Up @@ -333,6 +353,8 @@ def main():
description=dict(required=False, type="str"),
nat_inside=dict(required=False, type="raw"),
dns_name=dict(required=False, type="str"),
assigned_object_id=dict(required=False, type="str"),
assigned_object_type=dict(required=False, type="str"),
assigned_object=dict(
required=False,
type="dict",
Expand Down
Loading