Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_system_socfabric.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_system_socfabric
15 short_description: SOC Fabric.
16 version_added: "2.1.0"
17 extends_documentation_fragment:
18 - fortinet.fortimanager.general
19 - fortinet.fortimanager.general.partial_crud
20 options:
21 system_socfabric:
22 description: The top level parameters set.
23 required: false
24 type: dict
25 suboptions:
26 name:
27 type: str
28 description: Fabric name.
29 port:
30 type: int
31 description: Communication port
32 psk:
33 type: raw
34 description: (list) Fabric auth pwd.
35 role:
36 type: str
37 description:
38 - Enable or Disable SOC Fabric.
39 - member - SOC Fabric member.
40 - supervisor - SOC Fabric supervisor.
41 choices: ['member', 'supervisor']
42 secure_connection:
43 aliases: ['secure-connection']
44 type: str
45 description:
46 - Enable or Disable SSL/TLS.
47 - disable - Disable SSL/TLS.
48 - enable - Enable SSL/TLS.
49 choices: ['disable', 'enable']
50 status:
51 type: str
52 description:
53 - Enable or Disable SOC Fabric.
54 - disable - Disable SOC Fabric.
55 - enable - Enable SOC Fabric.
56 choices: ['disable', 'enable']
57 supervisor:
58 type: str
59 description: IP/FQDN of supervisor.
60 trusted_list:
61 aliases: ['trusted-list']
62 type: list
63 elements: dict
64 description: Trusted list.
65 suboptions:
66 id:
67 type: int
68 description: Trusted list ID.
69 serial:
70 type: str
71 description: FAZ serial number
72 '''
73
74 EXAMPLES = '''
75 - name: Example playbook (generated based on argument schema)
76 hosts: fortimanagers
77 connection: httpapi
78 gather_facts: false
79 tasks:
80 - name: SOC Fabric.
81 fortinet.fortimanager.fmgr_system_socfabric:
82 # workspace_locking_adom: <global or your adom name>
83 system_socfabric:
84 # name: <string>
85 # port: <integer>
86 # psk: <list or string>
87 # role: <value in [member, supervisor]>
88 # secure_connection: <value in [disable, enable]>
89 # status: <value in [disable, enable]>
90 # supervisor: <string>
91 # trusted_list:
92 # - id: <integer>
93 # serial: <string>
94 '''
95
96 RETURN = '''
97 meta:
98 description: The result of the request.
99 type: dict
100 returned: always
101 contains:
102 request_url:
103 description: The full url requested.
104 returned: always
105 type: str
106 sample: /sys/login/user
107 response_code:
108 description: The status of api request.
109 returned: always
110 type: int
111 sample: 0
112 response_data:
113 description: The api response.
114 type: list
115 returned: always
116 response_message:
117 description: The descriptive message of the api response.
118 type: str
119 returned: always
120 sample: OK.
121 system_information:
122 description: The information of the target system.
123 type: dict
124 returned: always
125 rc:
126 description: The status the request.
127 type: int
128 returned: always
129 sample: 0
130 version_check_warning:
131 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
132 type: list
133 returned: complex
134 '''
135 from ansible.module_utils.basic import AnsibleModule
136 from ansible.module_utils.connection import Connection
137 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
138 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
139
140
141 def main():
142 urls_list = [
143 '/cli/global/system/soc-fabric'
144 ]
145 module_arg_spec = {
146 'system_socfabric': {
147 'type': 'dict', 'v_range': [['7.0.0', '']],
148 'options': {
149 'name': {'v_range': [['7.0.0', '']], 'type': 'str'},
150 'port': {'v_range': [['7.0.0', '']], 'type': 'int'},
151 'psk': {'v_range': [['7.0.0', '7.2.12']], 'type': 'raw'},
152 'role': {'v_range': [['7.0.0', '']], 'choices': ['member', 'supervisor'], 'type': 'str'},
153 'secure-connection': {'v_range': [['7.0.0', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
154 'status': {'v_range': [['7.0.0', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
155 'supervisor': {'v_range': [['7.0.0', '']], 'type': 'str'},
156 'trusted-list': {
157 'v_range': [['7.4.0', '']],
158 'type': 'list',
159 'options': {'id': {'v_range': [['7.4.0', '']], 'type': 'int'}, 'serial': {'v_range': [['7.4.0', '']], 'type': 'str'}},
160 'elements': 'dict'
161 }
162 }
163 }
164 }
165
166 module_option_spec = get_module_arg_spec('partial crud')
167 module_arg_spec.update(module_option_spec)
168 check_galaxy_version(module_arg_spec)
169 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'system_socfabric'),
170 supports_check_mode=True)
171 if not module._socket_path:
172 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
173 connection = Connection(module._socket_path)
174 fmgr = NAPIManager('partial crud', module_arg_spec, urls_list,
175 None, 'data', module, connection)
176 fmgr.process_partial_crud()
177 module.exit_json(meta=module.params)
178
179
180 if __name__ == '__main__':
181 main()