Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_system_fmgcluster.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_fmgcluster
15 short_description: fmg clsuter.
16 version_added: "2.7.0"
17 extends_documentation_fragment:
18 - fortinet.fortimanager.general
19 - fortinet.fortimanager.general.partial_crud
20 options:
21 system_fmgcluster:
22 description: The top level parameters set.
23 required: false
24 type: dict
25 suboptions:
26 fqdn:
27 type: str
28 description: Local fqdn.
29 ip:
30 type: str
31 description: Local address.
32 mode:
33 type: str
34 description:
35 - Mode.
36 - standalone - Standalone.
37 - primary - Primary.
38 - worker - Worker.
39 choices: ['standalone', 'primary', 'worker']
40 peer:
41 type: list
42 elements: dict
43 description: Peer.
44 suboptions:
45 addr:
46 type: str
47 description: Address of peer.
48 fqdn:
49 type: str
50 description: FQDN of peer.
51 name:
52 type: str
53 description: Name of peer.
54 sn:
55 type: str
56 description: Serial number of peer.
57 '''
58
59 EXAMPLES = '''
60 - name: Example playbook (generated based on argument schema)
61 hosts: fortimanagers
62 connection: httpapi
63 gather_facts: false
64 tasks:
65 - name: Fmg clsuter.
66 fortinet.fortimanager.fmgr_system_fmgcluster:
67 # workspace_locking_adom: <global or your adom name>
68 system_fmgcluster:
69 # fqdn: <string>
70 # ip: <string>
71 # mode: <value in [standalone, primary, worker]>
72 # peer:
73 # - addr: <string>
74 # fqdn: <string>
75 # name: <string>
76 # sn: <string>
77 '''
78
79 RETURN = '''
80 meta:
81 description: The result of the request.
82 type: dict
83 returned: always
84 contains:
85 request_url:
86 description: The full url requested.
87 returned: always
88 type: str
89 sample: /sys/login/user
90 response_code:
91 description: The status of api request.
92 returned: always
93 type: int
94 sample: 0
95 response_data:
96 description: The api response.
97 type: list
98 returned: always
99 response_message:
100 description: The descriptive message of the api response.
101 type: str
102 returned: always
103 sample: OK.
104 system_information:
105 description: The information of the target system.
106 type: dict
107 returned: always
108 rc:
109 description: The status the request.
110 type: int
111 returned: always
112 sample: 0
113 version_check_warning:
114 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
115 type: list
116 returned: complex
117 '''
118 from ansible.module_utils.basic import AnsibleModule
119 from ansible.module_utils.connection import Connection
120 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
121 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
122
123
124 def main():
125 urls_list = [
126 '/cli/global/system/fmg-cluster'
127 ]
128 module_arg_spec = {
129 'system_fmgcluster': {
130 'type': 'dict', 'v_range': [['7.6.0', '']],
131 'options': {
132 'fqdn': {'v_range': [['7.6.0', '']], 'type': 'str'},
133 'ip': {'v_range': [['7.6.0', '']], 'type': 'str'},
134 'mode': {'v_range': [['7.6.0', '']], 'choices': ['standalone', 'primary', 'worker'], 'type': 'str'},
135 'peer': {
136 'v_range': [['7.6.0', '']],
137 'type': 'list',
138 'options': {
139 'addr': {'v_range': [['7.6.0', '']], 'type': 'str'},
140 'fqdn': {'v_range': [['7.6.0', '']], 'type': 'str'},
141 'name': {'v_range': [['7.6.0', '7.6.0']], 'type': 'str'},
142 'sn': {'v_range': [['7.6.0', '']], 'type': 'str'}
143 },
144 'elements': 'dict'
145 }
146 }
147 }
148 }
149
150 module_option_spec = get_module_arg_spec('partial crud')
151 module_arg_spec.update(module_option_spec)
152 check_galaxy_version(module_arg_spec)
153 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'system_fmgcluster'),
154 supports_check_mode=True)
155 if not module._socket_path:
156 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
157 connection = Connection(module._socket_path)
158 fmgr = NAPIManager('partial crud', module_arg_spec, urls_list,
159 None, 'data', module, connection)
160 fmgr.process_partial_crud()
161 module.exit_json(meta=module.params)
162
163
164 if __name__ == '__main__':
165 main()