Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_fmg_device_blueprint.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_fmg_device_blueprint
15 short_description: Fmg device blueprint
16 version_added: "2.1.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 fmg_device_blueprint:
29 description: The top level parameters set.
30 required: false
31 type: dict
32 suboptions:
33 cliprofs:
34 type: raw
35 description: (list) Cliprofs.
36 description:
37 type: str
38 description: Description.
39 dev_group:
40 aliases: ['dev-group']
41 type: raw
42 description: (list) Dev group.
43 folder:
44 type: str
45 description: Folder.
46 name:
47 type: str
48 description: Name.
49 required: true
50 pkg:
51 type: str
52 description: Pkg.
53 platform:
54 type: str
55 description: Platform.
56 prefer_img_ver:
57 aliases: ['prefer-img-ver']
58 type: str
59 description: Prefer img ver.
60 prerun_cliprof:
61 aliases: ['prerun-cliprof']
62 type: raw
63 description: (list) Prerun cliprof.
64 prov_type:
65 aliases: ['prov-type']
66 type: str
67 description: Prov type.
68 choices: ['none', 'templates', 'template-group']
69 template_group:
70 aliases: ['template-group']
71 type: str
72 description: Template group.
73 templates:
74 type: raw
75 description: (list) Templates.
76 enforce_device_config:
77 aliases: ['enforce-device-config']
78 type: str
79 description: Enforce device config.
80 choices: ['disable', 'enable']
81 auth_template:
82 aliases: ['auth-template']
83 type: raw
84 description: (list) Auth template.
85 ha_config:
86 aliases: ['ha-config']
87 type: str
88 description: Ha config.
89 choices: ['disable', 'enable']
90 ha_hbdev:
91 aliases: ['ha-hbdev']
92 type: raw
93 description: Ha hbdev.
94 ha_monitor:
95 aliases: ['ha-monitor']
96 type: raw
97 description: (list) Ha monitor.
98 ha_password:
99 aliases: ['ha-password']
100 type: raw
101 description: (list) Ha password.
102 linked_to_model:
103 aliases: ['linked-to-model']
104 type: str
105 description: Linked to model.
106 choices: ['disable', 'enable']
107 port_provisioning:
108 aliases: ['port-provisioning']
109 type: int
110 description: Port provisioning.
111 sdwan_management:
112 aliases: ['sdwan-management']
113 type: str
114 description: Sdwan management.
115 choices: ['disable', 'enable']
116 split_switch_port:
117 aliases: ['split-switch-port']
118 type: str
119 description: Split switch port.
120 choices: ['disable', 'enable']
121 vm_log_disk:
122 aliases: ['vm-log-disk']
123 type: str
124 description: Vm log disk.
125 choices: ['disable', 'enable']
126 '''
127
128 EXAMPLES = '''
129 - name: Example playbook (generated based on argument schema)
130 hosts: fortimanagers
131 connection: httpapi
132 gather_facts: false
133 tasks:
134 - name: Fmg device blueprint
135 fortinet.fortimanager.fmgr_fmg_device_blueprint:
136 # workspace_locking_adom: <global or your adom name>
137 adom: <your own value>
138 state: present # <value in [present, absent]>
139 fmg_device_blueprint:
140 name: "your value" # Required variable, string
141 # cliprofs: <list or string>
142 # description: <string>
143 # dev_group: <list or string>
144 # folder: <string>
145 # pkg: <string>
146 # platform: <string>
147 # prefer_img_ver: <string>
148 # prerun_cliprof: <list or string>
149 # prov_type: <value in [none, templates, template-group]>
150 # template_group: <string>
151 # templates: <list or string>
152 # enforce_device_config: <value in [disable, enable]>
153 # auth_template: <list or string>
154 # ha_config: <value in [disable, enable]>
155 # ha_hbdev: <any type>
156 # ha_monitor: <list or string>
157 # ha_password: <list or string>
158 # linked_to_model: <value in [disable, enable]>
159 # port_provisioning: <integer>
160 # sdwan_management: <value in [disable, enable]>
161 # split_switch_port: <value in [disable, enable]>
162 # vm_log_disk: <value in [disable, enable]>
163 '''
164
165 RETURN = '''
166 meta:
167 description: The result of the request.
168 type: dict
169 returned: always
170 contains:
171 request_url:
172 description: The full url requested.
173 returned: always
174 type: str
175 sample: /sys/login/user
176 response_code:
177 description: The status of api request.
178 returned: always
179 type: int
180 sample: 0
181 response_data:
182 description: The api response.
183 type: list
184 returned: always
185 response_message:
186 description: The descriptive message of the api response.
187 type: str
188 returned: always
189 sample: OK.
190 system_information:
191 description: The information of the target system.
192 type: dict
193 returned: always
194 rc:
195 description: The status the request.
196 type: int
197 returned: always
198 sample: 0
199 version_check_warning:
200 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
201 type: list
202 returned: complex
203 '''
204 from ansible.module_utils.basic import AnsibleModule
205 from ansible.module_utils.connection import Connection
206 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
207 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
208
209
210 def main():
211 urls_list = [
212 '/pm/config/adom/{adom}/obj/fmg/device/blueprint',
213 '/pm/config/global/obj/fmg/device/blueprint'
214 ]
215 module_arg_spec = {
216 'adom': {'required': True, 'type': 'str'},
217 'revision_note': {'type': 'str'},
218 'fmg_device_blueprint': {
219 'type': 'dict', 'v_range': [['7.2.0', '']],
220 'options': {
221 'cliprofs': {'v_range': [['7.2.0', '']], 'type': 'raw'},
222 'description': {'v_range': [['7.2.0', '']], 'type': 'str'},
223 'dev-group': {'v_range': [['7.2.0', '']], 'type': 'raw'},
224 'folder': {'v_range': [['7.2.0', '']], 'type': 'str'},
225 'name': {'v_range': [['7.2.0', '']], 'required': True, 'type': 'str'},
226 'pkg': {'v_range': [['7.2.0', '']], 'type': 'str'},
227 'platform': {'v_range': [['7.2.0', '']], 'type': 'str'},
228 'prefer-img-ver': {'v_range': [['7.2.0', '']], 'type': 'str'},
229 'prerun-cliprof': {'v_range': [['7.2.0', '']], 'type': 'raw'},
230 'prov-type': {'v_range': [['7.2.0', '']], 'choices': ['none', 'templates', 'template-group'], 'type': 'str'},
231 'template-group': {'v_range': [['7.2.0', '']], 'type': 'str'},
232 'templates': {'v_range': [['7.2.0', '']], 'type': 'raw'},
233 'enforce-device-config': {'v_range': [['7.2.5', '7.2.12'], ['7.4.2', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
234 'auth-template': {'v_range': [['7.4.1', '']], 'type': 'raw'},
235 'ha-config': {'v_range': [['7.4.1', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
236 'ha-hbdev': {'v_range': [['7.4.1', '']], 'type': 'raw'},
237 'ha-monitor': {'v_range': [['7.4.1', '']], 'type': 'raw'},
238 'ha-password': {'v_range': [['7.4.1', '']], 'no_log': True, 'type': 'raw'},
239 'linked-to-model': {'v_range': [['7.4.1', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
240 'port-provisioning': {'v_range': [['7.4.4', '']], 'type': 'int'},
241 'sdwan-management': {'v_range': [['7.6.0', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
242 'split-switch-port': {'v_range': [['7.4.4', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
243 'vm-log-disk': {'v_range': [['7.6.2', '']], 'choices': ['disable', 'enable'], 'type': 'str'}
244 }
245 }
246 }
247
248 module_option_spec = get_module_arg_spec('full crud')
249 module_arg_spec.update(module_option_spec)
250 check_galaxy_version(module_arg_spec)
251 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'fmg_device_blueprint'),
252 supports_check_mode=True)
253 if not module._socket_path:
254 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
255 connection = Connection(module._socket_path)
256 fmgr = NAPIManager('full crud', module_arg_spec, urls_list,
257 'name', 'data', module, connection)
258 fmgr.process_crud()
259 module.exit_json(meta=module.params)
260
261
262 if __name__ == '__main__':
263 main()