Skip to content

Commit ca174a1

Browse files
authored
Move common options to a doc fragment (#635)
* Move common options to a doc fragment
1 parent ad13803 commit ca174a1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+170
-1929
lines changed

plugins/doc_fragments/common.py

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# -*- coding: utf-8 -*-
2+
3+
# Copyright: (c) 2021, Devon Mar (@devon-mar)
4+
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
5+
6+
from __future__ import absolute_import, division, print_function
7+
8+
__metaclass__ = type
9+
10+
11+
class ModuleDocFragment(object):
12+
DOCUMENTATION = r"""
13+
---
14+
options:
15+
netbox_url:
16+
description:
17+
- The URL of the NetBox instance.
18+
- Must be accessible by the Ansible control host.
19+
required: true
20+
type: str
21+
netbox_token:
22+
description:
23+
- The NetBox API token.
24+
required: true
25+
type: str
26+
state:
27+
description:
28+
- The state of the object.
29+
choices:
30+
- present
31+
- absent
32+
default: present
33+
type: str
34+
query_params:
35+
description:
36+
- This can be used to override the specified values in ALLOWED_QUERY_PARAMS that are defined
37+
- in plugins/module_utils/netbox_utils.py and provides control to users on what may make
38+
- an object unique in their environment.
39+
required: false
40+
type: list
41+
elements: str
42+
validate_certs:
43+
description:
44+
- If C(no), SSL certificates will not be validated.
45+
- This should only be used on personally controlled sites using a self-signed certificates.
46+
default: true
47+
type: raw
48+
cert:
49+
description:
50+
- Certificate path
51+
required: false
52+
type: raw
53+
"""

plugins/modules/netbox_aggregate.py

Lines changed: 2 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -27,22 +27,9 @@
2727
requirements:
2828
- pynetbox
2929
version_added: '0.1.0'
30+
extends_documentation_fragment:
31+
- netbox.netbox.common
3032
options:
31-
netbox_url:
32-
description:
33-
- "URL of the NetBox instance resolvable by Ansible control host"
34-
required: true
35-
type: str
36-
netbox_token:
37-
description:
38-
- "The token created within NetBox to authorize API access"
39-
required: true
40-
type: str
41-
cert:
42-
description:
43-
- Certificate path
44-
required: false
45-
type: raw
4633
data:
4734
description:
4835
- "Defines the aggregate configuration"
@@ -80,25 +67,6 @@
8067
required: false
8168
type: dict
8269
required: true
83-
state:
84-
description:
85-
- "The state of the aggregate"
86-
choices: [ present, absent ]
87-
default: present
88-
type: str
89-
query_params:
90-
description:
91-
- This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined
92-
- in plugins/module_utils/netbox_utils.py and provides control to users on what may make
93-
- an object unique in their environment.
94-
required: false
95-
type: list
96-
elements: str
97-
validate_certs:
98-
description:
99-
- "If C(no), SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates."
100-
default: true
101-
type: raw
10270
"""
10371

10472
EXAMPLES = r"""

plugins/modules/netbox_cable.py

Lines changed: 2 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -28,22 +28,9 @@
2828
requirements:
2929
- pynetbox
3030
version_added: '0.3.0'
31+
extends_documentation_fragment:
32+
- netbox.netbox.common
3133
options:
32-
netbox_url:
33-
description:
34-
- URL of the NetBox instance resolvable by Ansible control host
35-
required: true
36-
type: str
37-
netbox_token:
38-
description:
39-
- The token created within NetBox to authorize API access
40-
required: true
41-
type: str
42-
cert:
43-
description:
44-
- Certificate path
45-
required: false
46-
type: raw
4734
data:
4835
type: dict
4936
required: true
@@ -156,25 +143,6 @@
156143
required: false
157144
type: list
158145
elements: raw
159-
state:
160-
description:
161-
- Use C(present) or C(absent) for adding or removing.
162-
choices: [ absent, present ]
163-
default: present
164-
type: str
165-
query_params:
166-
description:
167-
- This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined
168-
- in plugins/module_utils/netbox_utils.py and provides control to users on what may make
169-
- an object unique in their environment.
170-
required: false
171-
type: list
172-
elements: str
173-
validate_certs:
174-
description:
175-
- If C(no), SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates.
176-
default: true
177-
type: raw
178146
"""
179147

180148
EXAMPLES = r"""

plugins/modules/netbox_circuit.py

Lines changed: 2 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -27,22 +27,9 @@
2727
requirements:
2828
- pynetbox
2929
version_added: '0.1.0'
30+
extends_documentation_fragment:
31+
- netbox.netbox.common
3032
options:
31-
netbox_url:
32-
description:
33-
- URL of the NetBox instance resolvable by Ansible control host
34-
required: true
35-
type: str
36-
netbox_token:
37-
description:
38-
- The token created within NetBox to authorize API access
39-
required: true
40-
type: str
41-
cert:
42-
description:
43-
- Certificate path
44-
required: false
45-
type: raw
4633
data:
4734
type: dict
4835
required: true
@@ -105,25 +92,6 @@
10592
- must exist in NetBox
10693
required: false
10794
type: dict
108-
state:
109-
description:
110-
- Use C(present) or C(absent) for adding or removing.
111-
choices: [ absent, present ]
112-
default: present
113-
type: str
114-
query_params:
115-
description:
116-
- This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined
117-
- in plugins/module_utils/netbox_utils.py and provides control to users on what may make
118-
- an object unique in their environment.
119-
required: false
120-
type: list
121-
elements: str
122-
validate_certs:
123-
description:
124-
- If C(no), SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates.
125-
default: true
126-
type: raw
12795
"""
12896

12997
EXAMPLES = r"""

plugins/modules/netbox_circuit_termination.py

Lines changed: 2 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -27,22 +27,9 @@
2727
requirements:
2828
- pynetbox
2929
version_added: '0.1.0'
30+
extends_documentation_fragment:
31+
- netbox.netbox.common
3032
options:
31-
netbox_url:
32-
description:
33-
- URL of the NetBox instance resolvable by Ansible control host
34-
required: true
35-
type: str
36-
netbox_token:
37-
description:
38-
- The token created within NetBox to authorize API access
39-
required: true
40-
type: str
41-
cert:
42-
description:
43-
- Certificate path
44-
required: false
45-
type: raw
4633
data:
4734
required: true
4835
type: dict
@@ -92,25 +79,6 @@
9279
- Description of the circuit termination
9380
required: false
9481
type: str
95-
state:
96-
description:
97-
- Use C(present) or C(absent) for adding or removing.
98-
choices: [ absent, present ]
99-
default: present
100-
type: str
101-
query_params:
102-
description:
103-
- This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined
104-
- in plugins/module_utils/netbox_utils.py and provides control to users on what may make
105-
- an object unique in their environment.
106-
required: false
107-
type: list
108-
elements: str
109-
validate_certs:
110-
description:
111-
- If C(no), SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates.
112-
default: true
113-
type: raw
11482
"""
11583

11684
EXAMPLES = r"""

plugins/modules/netbox_circuit_type.py

Lines changed: 2 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -27,22 +27,9 @@
2727
requirements:
2828
- pynetbox
2929
version_added: '0.1.0'
30+
extends_documentation_fragment:
31+
- netbox.netbox.common
3032
options:
31-
netbox_url:
32-
description:
33-
- URL of the NetBox instance resolvable by Ansible control host
34-
required: true
35-
type: str
36-
netbox_token:
37-
description:
38-
- The token created within NetBox to authorize API access
39-
required: true
40-
type: str
41-
cert:
42-
description:
43-
- Certificate path
44-
required: false
45-
type: raw
4633
data:
4734
required: true
4835
type: dict
@@ -60,25 +47,6 @@
6047
- This is auto-generated following NetBox rules if not provided
6148
required: false
6249
type: str
63-
state:
64-
description:
65-
- Use C(present) or C(absent) for adding or removing.
66-
choices: [ absent, present ]
67-
default: present
68-
type: str
69-
query_params:
70-
description:
71-
- This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined
72-
- in plugins/module_utils/netbox_utils.py and provides control to users on what may make
73-
- an object unique in their environment.
74-
required: false
75-
type: list
76-
elements: str
77-
validate_certs:
78-
description:
79-
- If C(no), SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates.
80-
default: true
81-
type: raw
8250
"""
8351

8452
EXAMPLES = r"""

plugins/modules/netbox_cluster.py

Lines changed: 2 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -27,22 +27,9 @@
2727
requirements:
2828
- pynetbox
2929
version_added: '0.1.0'
30+
extends_documentation_fragment:
31+
- netbox.netbox.common
3032
options:
31-
netbox_url:
32-
description:
33-
- URL of the NetBox instance resolvable by Ansible control host
34-
required: true
35-
type: str
36-
netbox_token:
37-
description:
38-
- The token created within NetBox to authorize API access
39-
required: true
40-
type: str
41-
cert:
42-
description:
43-
- Certificate path
44-
required: false
45-
type: raw
4633
data:
4734
required: true
4835
type: dict
@@ -90,25 +77,6 @@
9077
- must exist in NetBox
9178
required: false
9279
type: dict
93-
state:
94-
description:
95-
- Use C(present) or C(absent) for adding or removing.
96-
choices: [ absent, present ]
97-
default: present
98-
type: str
99-
query_params:
100-
description:
101-
- This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined
102-
- in plugins/module_utils/netbox_utils.py and provides control to users on what may make
103-
- an object unique in their environment.
104-
required: false
105-
type: list
106-
elements: str
107-
validate_certs:
108-
description:
109-
- If C(no), SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates.
110-
default: true
111-
type: raw
11280
"""
11381

11482
EXAMPLES = r"""

0 commit comments

Comments
 (0)