Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_firewall_address6template.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_address6template
15 short_description: Configure IPv6 address templates.
16 version_added: "2.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_address6template:
29 description: The top level parameters set.
30 required: false
31 type: dict
32 suboptions:
33 ip6:
34 type: str
35 description: IPv6 address prefix.
36 name:
37 type: str
38 description: IPv6 address template name.
39 required: true
40 subnet_segment:
41 aliases: ['subnet-segment']
42 type: list
43 elements: dict
44 description: Subnet segment.
45 suboptions:
46 bits:
47 type: int
48 description: Number of bits.
49 exclusive:
50 type: str
51 description: Enable/disable exclusive value.
52 choices: ['disable', 'enable']
53 id:
54 type: int
55 description: Subnet segment ID.
56 name:
57 type: str
58 description: Subnet segment name.
59 values:
60 type: list
61 elements: dict
62 description: Values.
63 suboptions:
64 name:
65 type: str
66 description: Subnet segment value name.
67 value:
68 type: str
69 description: Subnet segment value.
70 subnet_segment_count:
71 aliases: ['subnet-segment-count']
72 type: int
73 description: Number of IPv6 subnet segments.
74 _image_base64:
75 aliases: ['_image-base64']
76 type: str
77 description: Image base64.
78 fabric_object:
79 aliases: ['fabric-object']
80 type: str
81 description: Security Fabric global object setting.
82 choices: ['disable', 'enable']
83 uuid:
84 type: str
85 description: Universally Unique Identifier
86 '''
87
88 EXAMPLES = '''
89 - name: Example playbook
90 hosts: fortimanagers
91 gather_facts: false
92 connection: httpapi
93 vars:
94 ansible_httpapi_use_ssl: true
95 ansible_httpapi_validate_certs: false
96 ansible_httpapi_port: 443
97 tasks:
98 - name: Configure IPv6 address templates.
99 fortinet.fortimanager.fmgr_firewall_address6template:
100 bypass_validation: false
101 adom: ansible
102 state: present
103 firewall_address6template:
104 ip6: "::33/128"
105 name: "ansible-name"
106 subnet_segment:
107 - bits: 1
108 exclusive: enable
109 id: 1
110 name: "ansible-name-sub"
111 values:
112 - name: "ansible-name-val"
113 value: "ansible"
114 subnet_segment_count: 2
115
116 - name: Gathering fortimanager facts
117 hosts: fortimanagers
118 gather_facts: false
119 connection: httpapi
120 vars:
121 ansible_httpapi_use_ssl: true
122 ansible_httpapi_validate_certs: false
123 ansible_httpapi_port: 443
124 tasks:
125 - name: Retrieve all the IPv6 address templates
126 fortinet.fortimanager.fmgr_fact:
127 facts:
128 selector: "firewall_address6template"
129 params:
130 adom: "ansible"
131 address6_template: "your_value"
132 '''
133
134 RETURN = '''
135 meta:
136 description: The result of the request.
137 type: dict
138 returned: always
139 contains:
140 request_url:
141 description: The full url requested.
142 returned: always
143 type: str
144 sample: /sys/login/user
145 response_code:
146 description: The status of api request.
147 returned: always
148 type: int
149 sample: 0
150 response_data:
151 description: The api response.
152 type: list
153 returned: always
154 response_message:
155 description: The descriptive message of the api response.
156 type: str
157 returned: always
158 sample: OK.
159 system_information:
160 description: The information of the target system.
161 type: dict
162 returned: always
163 rc:
164 description: The status the request.
165 type: int
166 returned: always
167 sample: 0
168 version_check_warning:
169 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
170 type: list
171 returned: complex
172 '''
173 from ansible.module_utils.basic import AnsibleModule
174 from ansible.module_utils.connection import Connection
175 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
176 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
177
178
179 def main():
180 urls_list = [
181 '/pm/config/adom/{adom}/obj/firewall/address6-template',
182 '/pm/config/global/obj/firewall/address6-template'
183 ]
184 module_arg_spec = {
185 'adom': {'required': True, 'type': 'str'},
186 'revision_note': {'type': 'str'},
187 'firewall_address6template': {
188 'type': 'dict', 'v_range': [['6.0.0', '']],
189 'options': {
190 'ip6': {'type': 'str'},
191 'name': {'required': True, 'type': 'str'},
192 'subnet-segment': {
193 'type': 'list',
194 'options': {
195 'bits': {'type': 'int'},
196 'exclusive': {'choices': ['disable', 'enable'], 'type': 'str'},
197 'id': {'type': 'int'},
198 'name': {'type': 'str'},
199 'values': {'type': 'list', 'options': {'name': {'type': 'str'}, 'value': {'type': 'str'}}, 'elements': 'dict'}
200 },
201 'elements': 'dict'
202 },
203 'subnet-segment-count': {'type': 'int'},
204 '_image-base64': {'v_range': [['6.2.2', '']], 'type': 'str'},
205 'fabric-object': {'v_range': [['7.0.0', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
206 'uuid': {'v_range': [['7.6.0', '']], 'type': 'str'}
207 }
208 }
209 }
210
211 module_option_spec = get_module_arg_spec('full crud')
212 module_arg_spec.update(module_option_spec)
213 check_galaxy_version(module_arg_spec)
214 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'firewall_address6template'),
215 supports_check_mode=True)
216 if not module._socket_path:
217 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
218 connection = Connection(module._socket_path)
219 fmgr = NAPIManager('full crud', module_arg_spec, urls_list,
220 'name', 'data', module, connection)
221 fmgr.process_crud()
222 module.exit_json(meta=module.params)
223
224
225 if __name__ == '__main__':
226 main()