Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_firewall_addrgrp6.py

raw symbols SCIP
1 #!/usr/bin/python
2 from __future__ import absolute_import, division, print_function
3 # Copyright 2019-2024 Fortinet, Inc.
4 # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
5
6 __metaclass__ = type
7
8 ANSIBLE_METADATA = {'status': ['preview'],
9 'supported_by': 'community',
10 'metadata_version': '1.1'}
11
12 DOCUMENTATION = '''
13 ---
14 module: fmgr_firewall_addrgrp6
15 short_description: Configure IPv6 address groups.
16 version_added: "1.0.0"
17 extends_documentation_fragment:
18 - fortinet.fortimanager.general
19 - fortinet.fortimanager.general.full_crud
20 options:
21 revision_note:
22 description: The change note that can be specified when an object is created or updated.
23 type: str
24 adom:
25 description: The parameter (adom) in requested url.
26 type: str
27 required: true
28 firewall_addrgrp6:
29 description: The top level parameters set.
30 required: false
31 type: dict
32 suboptions:
33 color:
34 type: int
35 description: Integer value to determine the color of the icon in the GUI
36 comment:
37 type: str
38 description: Comment.
39 dynamic_mapping:
40 type: list
41 elements: dict
42 description: Dynamic mapping.
43 suboptions:
44 _scope:
45 type: list
46 elements: dict
47 description: Scope.
48 suboptions:
49 name:
50 type: str
51 description: Name.
52 vdom:
53 type: str
54 description: Vdom.
55 color:
56 type: int
57 description: Color.
58 comment:
59 type: str
60 description: Comment.
61 member:
62 type: raw
63 description: (list or str) Member.
64 tags:
65 type: raw
66 description: (list or str) Tags.
67 uuid:
68 type: str
69 description: Uuid.
70 visibility:
71 type: str
72 description: Visibility.
73 choices: ['disable', 'enable']
74 _image_base64:
75 aliases: ['_image-base64']
76 type: str
77 description: Image base64.
78 global_object:
79 aliases: ['global-object']
80 type: int
81 description: Global object.
82 fabric_object:
83 aliases: ['fabric-object']
84 type: str
85 description: Security Fabric global object setting.
86 choices: ['disable', 'enable']
87 exclude:
88 type: str
89 description: Enable/disable address6 exclusion.
90 choices: ['disable', 'enable']
91 exclude_member:
92 aliases: ['exclude-member']
93 type: raw
94 description: (list) Address6 exclusion member.
95 member:
96 type: raw
97 description: (list or str) Address objects contained within the group.
98 name:
99 type: str
100 description: IPv6 address group name.
101 required: true
102 tagging:
103 type: list
104 elements: dict
105 description: Tagging.
106 suboptions:
107 category:
108 type: str
109 description: Tag category.
110 name:
111 type: str
112 description: Tagging entry name.
113 tags:
114 type: raw
115 description: (list) Tags.
116 uuid:
117 type: str
118 description: Universally Unique Identifier
119 visibility:
120 type: str
121 description: Enable/disable address group6 visibility in the GUI.
122 choices: ['disable', 'enable']
123 tags:
124 type: str
125 description: Names of object-tags applied to address.
126 _image_base64:
127 aliases: ['_image-base64']
128 type: str
129 description: Image base64.
130 global_object:
131 aliases: ['global-object']
132 type: int
133 description: Global Object.
134 fabric_object:
135 aliases: ['fabric-object']
136 type: str
137 description: Security Fabric global object setting.
138 choices: ['disable', 'enable']
139 exclude:
140 type: str
141 description: Enable/disable address6 exclusion.
142 choices: ['disable', 'enable']
143 exclude_member:
144 aliases: ['exclude-member']
145 type: raw
146 description: (list) Address6 exclusion member.
147 '''
148
149 EXAMPLES = '''
150 - name: Example playbook
151 hosts: fortimanagers
152 gather_facts: false
153 connection: httpapi
154 vars:
155 ansible_httpapi_use_ssl: true
156 ansible_httpapi_validate_certs: false
157 ansible_httpapi_port: 443
158 tasks:
159 - name: Configure IPv6 address groups.
160 fortinet.fortimanager.fmgr_firewall_addrgrp6:
161 bypass_validation: false
162 adom: ansible
163 state: present
164 firewall_addrgrp6:
165 color: 0
166 comment: "ansible-comment"
167 member: "ansible-test" # IPv6 address name
168 name: "ansible-addrgrp6" # could not the same with other group, adress name, including IPv4 group and address
169 visibility: enable
170
171 - name: Gathering fortimanager facts
172 hosts: fortimanagers
173 gather_facts: false
174 connection: httpapi
175 vars:
176 ansible_httpapi_use_ssl: true
177 ansible_httpapi_validate_certs: false
178 ansible_httpapi_port: 443
179 tasks:
180 - name: Retrieve all the IPv6 address groups
181 fortinet.fortimanager.fmgr_fact:
182 facts:
183 selector: "firewall_addrgrp6"
184 params:
185 adom: "ansible"
186 addrgrp6: "your_value"
187 '''
188
189 RETURN = '''
190 meta:
191 description: The result of the request.
192 type: dict
193 returned: always
194 contains:
195 request_url:
196 description: The full url requested.
197 returned: always
198 type: str
199 sample: /sys/login/user
200 response_code:
201 description: The status of api request.
202 returned: always
203 type: int
204 sample: 0
205 response_data:
206 description: The api response.
207 type: list
208 returned: always
209 response_message:
210 description: The descriptive message of the api response.
211 type: str
212 returned: always
213 sample: OK.
214 system_information:
215 description: The information of the target system.
216 type: dict
217 returned: always
218 rc:
219 description: The status the request.
220 type: int
221 returned: always
222 sample: 0
223 version_check_warning:
224 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
225 type: list
226 returned: complex
227 '''
228 from ansible.module_utils.basic import AnsibleModule
229 from ansible.module_utils.connection import Connection
230 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
231 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
232
233
234 def main():
235 urls_list = [
236 '/pm/config/adom/{adom}/obj/firewall/addrgrp6',
237 '/pm/config/global/obj/firewall/addrgrp6'
238 ]
239 module_arg_spec = {
240 'adom': {'required': True, 'type': 'str'},
241 'revision_note': {'type': 'str'},
242 'firewall_addrgrp6': {
243 'type': 'dict', 'v_range': [['6.0.0', '']],
244 'options': {
245 'color': {'type': 'int'},
246 'comment': {'type': 'str'},
247 'dynamic_mapping': {
248 'type': 'list',
249 'options': {
250 '_scope': {'type': 'list', 'options': {'name': {'type': 'str'}, 'vdom': {'type': 'str'}}, 'elements': 'dict'},
251 'color': {'type': 'int'},
252 'comment': {'type': 'str'},
253 'member': {'type': 'raw'},
254 'tags': {'type': 'raw'},
255 'uuid': {'type': 'str'},
256 'visibility': {'choices': ['disable', 'enable'], 'type': 'str'},
257 '_image-base64': {'v_range': [['6.2.2', '']], 'type': 'str'},
258 'global-object': {'v_range': [['6.4.0', '']], 'type': 'int'},
259 'fabric-object': {'v_range': [['6.4.4', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
260 'exclude': {'v_range': [['7.4.0', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
261 'exclude-member': {'v_range': [['7.4.0', '']], 'type': 'raw'}
262 },
263 'elements': 'dict'
264 },
265 'member': {'type': 'raw'},
266 'name': {'required': True, 'type': 'str'},
267 'tagging': {
268 'type': 'list',
269 'options': {'category': {'type': 'str'}, 'name': {'type': 'str'}, 'tags': {'type': 'raw'}},
270 'elements': 'dict'
271 },
272 'uuid': {'type': 'str'},
273 'visibility': {'v_range': [['6.0.0', '7.6.2']], 'choices': ['disable', 'enable'], 'type': 'str'},
274 'tags': {'v_range': [['6.2.0', '6.4.15'], ['7.4.8', '7.4.10']], 'type': 'str'},
275 '_image-base64': {'v_range': [['6.2.2', '']], 'type': 'str'},
276 'global-object': {'v_range': [['6.4.0', '']], 'type': 'int'},
277 'fabric-object': {'v_range': [['6.4.4', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
278 'exclude': {'v_range': [['7.4.0', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
279 'exclude-member': {'v_range': [['7.4.0', '']], 'type': 'raw'}
280 }
281 }
282 }
283
284 module_option_spec = get_module_arg_spec('full crud')
285 module_arg_spec.update(module_option_spec)
286 check_galaxy_version(module_arg_spec)
287 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'firewall_addrgrp6'),
288 supports_check_mode=True)
289 if not module._socket_path:
290 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
291 connection = Connection(module._socket_path)
292 fmgr = NAPIManager('full crud', module_arg_spec, urls_list,
293 'name', 'data', module, connection)
294 fmgr.process_crud()
295 module.exit_json(meta=module.params)
296
297
298 if __name__ == '__main__':
299 main()