Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_credentialstore_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_credentialstore_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 credentialstore_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 hostname:
57 type: str
58 description: Hostname of the server to connect to.
59 '''
60
61 EXAMPLES = '''
62 - name: Example playbook (generated based on argument schema)
63 hosts: fortimanagers
64 connection: httpapi
65 gather_facts: false
66 tasks:
67 - name: Define known domain controller servers.
68 fortinet.fortimanager.fmgr_credentialstore_domaincontroller:
69 # workspace_locking_adom: <global or your adom name>
70 adom: <your own value>
71 state: present # <value in [present, absent]>
72 credentialstore_domaincontroller:
73 # domain_name: <string>
74 # ip: <string>
75 # ip6: <string>
76 # password: <list or string>
77 # port: <integer>
78 # server_name: <string>
79 # username: <string>
80 # hostname: <string>
81 '''
82
83 RETURN = '''
84 meta:
85 description: The result of the request.
86 type: dict
87 returned: always
88 contains:
89 request_url:
90 description: The full url requested.
91 returned: always
92 type: str
93 sample: /sys/login/user
94 response_code:
95 description: The status of api request.
96 returned: always
97 type: int
98 sample: 0
99 response_data:
100 description: The api response.
101 type: list
102 returned: always
103 response_message:
104 description: The descriptive message of the api response.
105 type: str
106 returned: always
107 sample: OK.
108 system_information:
109 description: The information of the target system.
110 type: dict
111 returned: always
112 rc:
113 description: The status the request.
114 type: int
115 returned: always
116 sample: 0
117 version_check_warning:
118 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
119 type: list
120 returned: complex
121 '''
122 from ansible.module_utils.basic import AnsibleModule
123 from ansible.module_utils.connection import Connection
124 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
125 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
126
127
128 def main():
129 urls_list = [
130 '/pm/config/adom/{adom}/obj/credential-store/domain-controller',
131 '/pm/config/global/obj/credential-store/domain-controller'
132 ]
133 module_arg_spec = {
134 'adom': {'required': True, 'type': 'str'},
135 'revision_note': {'type': 'str'},
136 'credentialstore_domaincontroller': {
137 'type': 'dict', 'v_range': [['6.4.0', '']],
138 'options': {
139 'domain-name': {'v_range': [['6.4.0', '']], 'type': 'str'},
140 'ip': {'v_range': [['6.4.0', '']], 'type': 'str'},
141 'ip6': {'v_range': [['6.4.0', '']], 'type': 'str'},
142 'password': {'v_range': [['6.4.0', '']], 'no_log': True, 'type': 'raw'},
143 'port': {'v_range': [['6.4.0', '']], 'type': 'int'},
144 'server-name': {'v_range': [['6.4.0', '']], 'type': 'str'},
145 'username': {'v_range': [['6.4.0', '']], 'type': 'str'},
146 'hostname': {'v_range': [['6.4.2', '']], 'type': 'str'}
147 }
148 }
149 }
150
151 module_option_spec = get_module_arg_spec('full crud')
152 module_arg_spec.update(module_option_spec)
153 check_galaxy_version(module_arg_spec)
154 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'credentialstore_domaincontroller'),
155 supports_check_mode=True)
156 if not module._socket_path:
157 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
158 connection = Connection(module._socket_path)
159 fmgr = NAPIManager('full crud', module_arg_spec, urls_list,
160 None, 'data', module, connection)
161 fmgr.process_crud()
162 module.exit_json(meta=module.params)
163
164
165 if __name__ == '__main__':
166 main()