Skip to content

Commit 86849f8

Browse files
authored
Add new options for NetBox 3.4 (#905)
1 parent af6e4b1 commit 86849f8

27 files changed

+502
-262
lines changed

plugins/modules/netbox_aggregate.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,12 @@
4949
- "The description of the aggregate"
5050
required: false
5151
type: str
52+
comments:
53+
description:
54+
- Comments that may include additional information in regards to the aggregate
55+
required: false
56+
type: str
57+
version_added: "3.10.0"
5258
tags:
5359
description:
5460
- "Any tags that the aggregate may need to be associated with"
@@ -138,6 +144,7 @@ def main():
138144
rir=dict(required=False, type="raw"),
139145
date_added=dict(required=False, type="str"),
140146
description=dict(required=False, type="str"),
147+
comments=dict(required=False, type="str"),
141148
tags=dict(required=False, type="list", elements="raw"),
142149
custom_fields=dict(required=False, type="dict"),
143150
),

plugins/modules/netbox_cable.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,18 @@
131131
- in
132132
required: false
133133
type: str
134+
description:
135+
description:
136+
- Description of the provider
137+
required: false
138+
type: str
139+
version_added: "3.10.0"
140+
comments:
141+
description:
142+
- Comments related to the provider
143+
required: false
144+
type: str
145+
version_added: "3.10.0"
134146
tags:
135147
description:
136148
- Any tags that the cable may need to be associated with
@@ -308,6 +320,8 @@ def main():
308320
length_unit=dict(
309321
required=False, choices=["m", "cm", "ft", "in"], type="str"
310322
),
323+
description=dict(required=False, type="str"),
324+
comments=dict(required=False, type="str"),
311325
tags=dict(required=False, type="list", elements="raw"),
312326
custom_fields=dict(required=False, type="dict"),
313327
),

plugins/modules/netbox_cluster.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,12 @@
5050
- Required if I(state=present) and the cluster does not exist yet
5151
required: false
5252
type: raw
53+
description:
54+
description:
55+
- The description of the cluster
56+
required: false
57+
type: str
58+
version_added: "3.10.0"
5359
comments:
5460
description:
5561
- Comments that may include additional information in regards to the cluster
@@ -158,6 +164,7 @@ def main():
158164
cluster_group=dict(required=False, type="raw"),
159165
site=dict(required=False, type="raw"),
160166
tenant=dict(required=False, type="raw"),
167+
description=dict(required=False, type="str"),
161168
comments=dict(required=False, type="str"),
162169
tags=dict(required=False, type="list", elements="raw"),
163170
custom_fields=dict(required=False, type="dict"),

plugins/modules/netbox_contact.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,12 @@
5454
- The address of the contact
5555
required: false
5656
type: str
57+
description:
58+
description:
59+
- The description of the contact
60+
required: false
61+
type: str
62+
version_added: "3.10.0"
5763
comments:
5864
description:
5965
- Comments on the contact
@@ -69,7 +75,7 @@
6975
- URL associated with the contact
7076
required: false
7177
type: str
72-
version_added: "3.7.0"
78+
version_added: "3.7.0"
7379
tags:
7480
description:
7581
- Any tags that the contact may need to be associated with
@@ -160,6 +166,7 @@ def main():
160166
phone=dict(required=False, type="str"),
161167
email=dict(required=False, type="str"),
162168
address=dict(required=False, type="str"),
169+
description=dict(required=False, type="str"),
163170
comments=dict(required=False, type="str"),
164171
contact_group=dict(required=False, type="raw"),
165172
link=dict(required=False, type="str"),

plugins/modules/netbox_custom_field.py

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
- text
4343
- longtext
4444
- integer
45+
- decimal
4546
- boolean
4647
- date
4748
- url
@@ -92,12 +93,28 @@
9293
- Fields with higher weights appear lower in a form
9394
required: false
9495
type: int
96+
search_weight:
97+
description:
98+
- Weighting for search. Lower values are considered more important. Fields with a search weight of zero will be ignored.
99+
required: false
100+
type: int
101+
version_added: "3.10.0"
95102
group_name:
96103
description:
97104
- The group to associate the custom field with
98105
required: false
99106
type: str
100107
version_added: "3.10.0"
108+
ui_visibility:
109+
description:
110+
- The UI visibility of the custom field
111+
required: false
112+
choices:
113+
- read-write
114+
- read-only
115+
- hidden
116+
type: str
117+
version_added: "3.10.0"
101118
validation_minimum:
102119
description:
103120
- The minimum allowed value (for numeric fields)
@@ -144,7 +161,15 @@
144161
netbox_token: thisIsMyToken
145162
data:
146163
name: A Custom Field
147-
required: yes
164+
required: yes
165+
166+
- name: Update the custom field to make it read only
167+
netbox.netbox.netbox_custom_field:
168+
netbox_url: http://netbox.local
169+
netbox_token: thisIsMyToken
170+
data:
171+
name: A Custom Field
172+
ui_visibility: read-only
148173
149174
- name: Delete the custom field
150175
netbox.netbox.netbox_custom_field:
@@ -195,6 +220,7 @@ def main():
195220
"text",
196221
"longtext",
197222
"integer",
223+
"decimal",
198224
"boolean",
199225
"date",
200226
"url",
@@ -214,7 +240,17 @@ def main():
214240
filter_logic=dict(required=False, type="raw"),
215241
default=dict(required=False, type="raw"),
216242
weight=dict(required=False, type="int"),
243+
search_weight=dict(required=False, type="int"),
217244
group_name=dict(required=False, type="str"),
245+
ui_visibility=dict(
246+
required=False,
247+
choices=[
248+
"read-write",
249+
"read-only",
250+
"hidden",
251+
],
252+
type="str",
253+
),
218254
validation_minimum=dict(required=False, type="int"),
219255
validation_maximum=dict(required=False, type="int"),
220256
validation_regex=dict(required=False, type="str"),

plugins/modules/netbox_custom_link.py

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,14 @@
3333
description:
3434
- The content type to apply this custom link to
3535
required: false
36-
type: raw
36+
type: raw
37+
content_types:
38+
description:
39+
- The content type to apply this custom link to (NetBox 3.4+)
40+
required: false
41+
type: list
42+
elements: raw
43+
version_added: "3.10.0"
3744
name:
3845
description:
3946
- The name of the custom link
@@ -139,6 +146,7 @@ def main():
139146
required=True,
140147
options=dict(
141148
content_type=dict(required=False, type="raw"),
149+
content_types=dict(required=False, type="list", elements="raw"),
142150
name=dict(required=True, type="str"),
143151
link_text=dict(required=True, type="raw"),
144152
link_url=dict(required=True, type="raw"),
@@ -153,12 +161,17 @@ def main():
153161
)
154162

155163
required_if = [
156-
("state", "present", ["content_type", "name", "link_text", "link_url"]),
164+
("state", "present", ["name", "link_text", "link_url"]),
157165
("state", "absent", ["name"]),
158166
]
159167

168+
required_one_of = [("content_type", "content_types")]
169+
160170
module = NetboxAnsibleModule(
161-
argument_spec=argument_spec, supports_check_mode=True, required_if=required_if
171+
argument_spec=argument_spec,
172+
supports_check_mode=True,
173+
required_if=required_if,
174+
required_one_of=required_one_of,
162175
)
163176

164177
netbox_custom_link = NetboxExtrasModule(module, NB_CUSTOM_LINKS)

plugins/modules/netbox_device.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,12 @@
131131
- Priority in the assigned virtual chassis
132132
required: false
133133
type: int
134+
description:
135+
description:
136+
- Description of the provider
137+
required: false
138+
type: str
139+
version_added: "3.10.0"
134140
comments:
135141
description:
136142
- Comments that may include additional information in regards to the device
@@ -277,6 +283,7 @@ def main():
277283
virtual_chassis=dict(required=False, type="raw"),
278284
vc_position=dict(required=False, type="int"),
279285
vc_priority=dict(required=False, type="int"),
286+
description=dict(required=False, type="str"),
280287
comments=dict(required=False, type="str"),
281288
tags=dict(required=False, type="list", elements="raw"),
282289
local_context_data=dict(required=False, type="dict"),

plugins/modules/netbox_device_type.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,23 @@
5555
- The height of the device type in rack units
5656
required: false
5757
type: int
58+
weight:
59+
description:
60+
- The weight of the device type
61+
required: false
62+
type: float
63+
version_added: "3.10.0"
64+
weight_unit:
65+
description:
66+
- The weight unit
67+
choices:
68+
- kg
69+
- g
70+
- lb
71+
- oz
72+
required: false
73+
type: str
74+
version_added: "3.10.0"
5875
is_full_depth:
5976
description:
6077
- Whether or not the device consumes both front and rear rack faces
@@ -70,6 +87,12 @@
7087
- child
7188
required: false
7289
type: str
90+
description:
91+
description:
92+
- Description of the provider
93+
required: false
94+
type: str
95+
version_added: "3.10.0"
7396
comments:
7497
description:
7598
- Comments that may include additional information in regards to the device_type
@@ -168,12 +191,24 @@ def main():
168191
slug=dict(required=False, type="str"),
169192
part_number=dict(required=False, type="str"),
170193
u_height=dict(required=False, type="int"),
194+
weight=dict(required=False, type="float"),
195+
weight_unit=dict(
196+
required=False,
197+
type="str",
198+
choices=[
199+
"kg",
200+
"g",
201+
"lb",
202+
"oz",
203+
],
204+
),
171205
is_full_depth=dict(required=False, type="bool"),
172206
subdevice_role=dict(
173207
required=False,
174208
choices=["Parent", "parent", "Child", "child"],
175209
type="str",
176210
),
211+
description=dict(required=False, type="str"),
177212
comments=dict(required=False, type="str"),
178213
tags=dict(required=False, type="list", elements="raw"),
179214
custom_fields=dict(required=False, type="dict"),

plugins/modules/netbox_export_template.py

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,14 @@
3333
description:
3434
- The content type to apply this export template to
3535
required: false
36-
type: raw
36+
type: raw
37+
content_types:
38+
description:
39+
- The content type to apply this export template to (NetBox 3.4+)
40+
required: false
41+
type: list
42+
elements: raw
43+
version_added: "3.10.0"
3744
name:
3845
description:
3946
- The name of the export template
@@ -128,6 +135,7 @@ def main():
128135
required=True,
129136
options=dict(
130137
content_type=dict(required=False, type="raw"),
138+
content_types=dict(required=False, type="list", elements="raw"),
131139
name=dict(required=True, type="str"),
132140
description=dict(required=False, type="str"),
133141
template_code=dict(required=True, type="raw"),
@@ -140,12 +148,17 @@ def main():
140148
)
141149

142150
required_if = [
143-
("state", "present", ["content_type", "name", "template_code"]),
151+
("state", "present", ["name", "template_code"]),
144152
("state", "absent", ["name"]),
145153
]
146154

155+
required_one_of = [["content_type", "content_types"]]
156+
147157
module = NetboxAnsibleModule(
148-
argument_spec=argument_spec, supports_check_mode=True, required_if=required_if
158+
argument_spec=argument_spec,
159+
supports_check_mode=True,
160+
required_if=required_if,
161+
required_one_of=required_one_of,
149162
)
150163

151164
netbox_export_template = NetboxExtrasModule(module, NB_EXPORT_TEMPLATES)

plugins/modules/netbox_ip_address.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,12 @@
131131
- The virtual machine the interface is attached to.
132132
type: str
133133
required: False
134+
comments:
135+
description:
136+
- Comments that may include additional information in regards to the IP Address
137+
required: false
138+
type: str
139+
version_added: "3.10.0"
134140
tags:
135141
description:
136142
- Any tags that the IP address may need to be associated with
@@ -336,6 +342,7 @@ def main():
336342
virtual_machine=dict(required=False, type="str"),
337343
),
338344
),
345+
comments=dict(required=False, type="str"),
339346
tags=dict(required=False, type="list", elements="raw"),
340347
custom_fields=dict(required=False, type="dict"),
341348
),

plugins/modules/netbox_l2vpn.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,12 @@
6161
- The description of the L2VPN
6262
required: false
6363
type: str
64+
comments:
65+
description:
66+
- Comments that may include additional information in regards to the L2VPN
67+
required: false
68+
type: str
69+
version_added: "3.10.0"
6470
tenant:
6571
description:
6672
- The tenant that the L2VPN will be assigned to
@@ -163,6 +169,7 @@ def main():
163169
import_targets=dict(required=False, type="list", elements="raw"),
164170
export_targets=dict(required=False, type="list", elements="raw"),
165171
description=dict(required=False, type="str"),
172+
comments=dict(required=False, type="str"),
166173
tenant=dict(required=False, type="raw"),
167174
tags=dict(required=False, type="list", elements="raw"),
168175
custom_fields=dict(required=False, type="dict"),

0 commit comments

Comments
 (0)