Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_apcfgprofile.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_apcfgprofile
15 short_description: Configure AP local configuration profiles.
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 apcfgprofile:
29 description: The top level parameters set.
30 required: false
31 type: dict
32 suboptions:
33 ac_ip:
34 aliases: ['ac-ip']
35 type: str
36 description: IP address of the validation controller that AP must be able to join after applying AP local configuration.
37 ac_port:
38 aliases: ['ac-port']
39 type: int
40 description: Port of the validation controller that AP must be able to join after applying AP local configuration
41 ac_timer:
42 aliases: ['ac-timer']
43 type: int
44 description: Maximum waiting time for the AP to join the validation controller after applying AP local configuration
45 ac_type:
46 aliases: ['ac-type']
47 type: str
48 description: Validation controller type
49 choices: ['default', 'specify', 'apcfg']
50 command_list:
51 aliases: ['command-list']
52 type: list
53 elements: dict
54 description: Command list.
55 suboptions:
56 id:
57 type: int
58 description: Command ID.
59 name:
60 type: str
61 description: AP local configuration command name.
62 passwd_value:
63 aliases: ['passwd-value']
64 type: raw
65 description: (list) AP local configuration command password value.
66 type:
67 type: str
68 description: The command type
69 choices: ['non-password', 'password']
70 value:
71 type: str
72 description: AP local configuration command value.
73 comment:
74 type: str
75 description: Comment.
76 name:
77 type: str
78 description: AP local configuration profile name.
79 required: true
80 ap_family:
81 aliases: ['ap-family']
82 type: str
83 description: FortiAP family type
84 choices: ['fap', 'fap-u', 'fap-c']
85 '''
86
87 EXAMPLES = '''
88 - name: Example playbook (generated based on argument schema)
89 hosts: fortimanagers
90 connection: httpapi
91 gather_facts: false
92 tasks:
93 - name: Configure AP local configuration profiles.
94 fortinet.fortimanager.fmgr_apcfgprofile:
95 # workspace_locking_adom: <global or your adom name>
96 adom: <your own value>
97 state: present # <value in [present, absent]>
98 apcfgprofile:
99 name: "your value" # Required variable, string
100 # ac_ip: <string>
101 # ac_port: <integer>
102 # ac_timer: <integer>
103 # ac_type: <value in [default, specify, apcfg]>
104 # command_list:
105 # - id: <integer>
106 # name: <string>
107 # passwd_value: <list or string>
108 # type: <value in [non-password, password]>
109 # value: <string>
110 # comment: <string>
111 # ap_family: <value in [fap, fap-u, fap-c]>
112 '''
113
114 RETURN = '''
115 meta:
116 description: The result of the request.
117 type: dict
118 returned: always
119 contains:
120 request_url:
121 description: The full url requested.
122 returned: always
123 type: str
124 sample: /sys/login/user
125 response_code:
126 description: The status of api request.
127 returned: always
128 type: int
129 sample: 0
130 response_data:
131 description: The api response.
132 type: list
133 returned: always
134 response_message:
135 description: The descriptive message of the api response.
136 type: str
137 returned: always
138 sample: OK.
139 system_information:
140 description: The information of the target system.
141 type: dict
142 returned: always
143 rc:
144 description: The status the request.
145 type: int
146 returned: always
147 sample: 0
148 version_check_warning:
149 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
150 type: list
151 returned: complex
152 '''
153 from ansible.module_utils.basic import AnsibleModule
154 from ansible.module_utils.connection import Connection
155 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
156 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
157
158
159 def main():
160 urls_list = [
161 '/pm/config/adom/{adom}/obj/wireless-controller/apcfg-profile',
162 '/pm/config/global/obj/wireless-controller/apcfg-profile'
163 ]
164 module_arg_spec = {
165 'adom': {'required': True, 'type': 'str'},
166 'revision_note': {'type': 'str'},
167 'apcfgprofile': {
168 'type': 'dict', 'v_range': [['6.4.6', '']],
169 'options': {
170 'ac-ip': {'v_range': [['6.4.6', '']], 'type': 'str'},
171 'ac-port': {'v_range': [['6.4.6', '']], 'type': 'int'},
172 'ac-timer': {'v_range': [['6.4.6', '']], 'type': 'int'},
173 'ac-type': {'v_range': [['6.4.6', '']], 'choices': ['default', 'specify', 'apcfg'], 'type': 'str'},
174 'command-list': {
175 'v_range': [['6.4.6', '']],
176 'type': 'list',
177 'options': {
178 'id': {'v_range': [['6.4.6', '']], 'type': 'int'},
179 'name': {'v_range': [['6.4.6', '']], 'type': 'str'},
180 'passwd-value': {'v_range': [['6.4.6', '']], 'no_log': True, 'type': 'raw'},
181 'type': {'v_range': [['6.4.6', '']], 'choices': ['non-password', 'password'], 'type': 'str'},
182 'value': {'v_range': [['6.4.6', '']], 'type': 'str'}
183 },
184 'elements': 'dict'
185 },
186 'comment': {'v_range': [['6.4.6', '']], 'type': 'str'},
187 'name': {'v_range': [['6.4.6', '']], 'required': True, 'type': 'str'},
188 'ap-family': {'v_range': [['6.4.8', '6.4.15'], ['7.0.2', '']], 'choices': ['fap', 'fap-u', 'fap-c'], 'type': 'str'}
189 }
190 }
191 }
192
193 module_option_spec = get_module_arg_spec('full crud')
194 module_arg_spec.update(module_option_spec)
195 check_galaxy_version(module_arg_spec)
196 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'apcfgprofile'),
197 supports_check_mode=True)
198 if not module._socket_path:
199 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
200 connection = Connection(module._socket_path)
201 fmgr = NAPIManager('full crud', module_arg_spec, urls_list,
202 'name', 'data', module, connection)
203 fmgr.process_crud()
204 module.exit_json(meta=module.params)
205
206
207 if __name__ == '__main__':
208 main()