Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_cifs_domaincontroller.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_cifs_domaincontroller
15 short_description: Define known domain controller servers.
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 cifs_domaincontroller:
29 description: The top level parameters set.
30 required: false
31 type: dict
32 suboptions:
33 domain_name:
34 aliases: ['domain-name']
35 type: str
36 description: Fully qualified domain name
37 ip:
38 type: str
39 description: IPv4 server address.
40 ip6:
41 type: str
42 description: IPv6 server address.
43 password:
44 type: raw
45 description: (list) Password for specified username.
46 port:
47 type: int
48 description: Port number of service.
49 server_name:
50 aliases: ['server-name']
51 type: str
52 description: Name of the server to connect to.
53 username:
54 type: str
55 description: User name to sign in with.
56 '''
57
58 EXAMPLES = '''
59 - name: Example playbook (generated based on argument schema)
60 hosts: fortimanagers
61 connection: httpapi
62 gather_facts: false
63 tasks:
64 - name: Define known domain controller servers.
65 fortinet.fortimanager.fmgr_cifs_domaincontroller:
66 # workspace_locking_adom: <global or your adom name>
67 adom: <your own value>
68 state: present # <value in [present, absent]>
69 cifs_domaincontroller:
70 # domain_name: <string>
71 # ip: <string>
72 # ip6: <string>
73 # password: <list or string>
74 # port: <integer>
75 # server_name: <string>
76 # username: <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 '/pm/config/adom/{adom}/obj/cifs/domain-controller',
127 '/pm/config/global/obj/cifs/domain-controller'
128 ]
129 module_arg_spec = {
130 'adom': {'required': True, 'type': 'str'},
131 'revision_note': {'type': 'str'},
132 'cifs_domaincontroller': {
133 'type': 'dict', 'v_range': [['6.2.0', '7.6.2']],
134 'options': {
135 'domain-name': {'v_range': [['6.2.0', '7.6.2']], 'type': 'str'},
136 'ip': {'v_range': [['6.2.0', '7.6.2']], 'type': 'str'},
137 'ip6': {'v_range': [['6.2.0', '7.6.2']], 'type': 'str'},
138 'password': {'v_range': [['6.2.0', '7.6.2']], 'no_log': True, 'type': 'raw'},
139 'port': {'v_range': [['6.2.0', '7.6.2']], 'type': 'int'},
140 'server-name': {'v_range': [['6.2.0', '7.6.2']], 'type': 'str'},
141 'username': {'v_range': [['6.2.0', '7.6.2']], 'type': 'str'}
142 }
143 }
144 }
145
146 module_option_spec = get_module_arg_spec('full crud')
147 module_arg_spec.update(module_option_spec)
148 check_galaxy_version(module_arg_spec)
149 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'cifs_domaincontroller'),
150 supports_check_mode=True)
151 if not module._socket_path:
152 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
153 connection = Connection(module._socket_path)
154 fmgr = NAPIManager('full crud', module_arg_spec, urls_list,
155 None, 'data', module, connection)
156 fmgr.process_crud()
157 module.exit_json(meta=module.params)
158
159
160 if __name__ == '__main__':
161 main()