| 1 |
|
| 2 |
from __future__ import absolute_import, division, print_function |
| 3 |
|
| 4 |
|
| 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_extensioncontroller_extendervap |
| 15 |
short_description: FortiExtender wifi vap configuration. |
| 16 |
version_added: "2.10.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 |
extensioncontroller_extendervap: |
| 29 |
description: The top level parameters set. |
| 30 |
required: false |
| 31 |
type: dict |
| 32 |
suboptions: |
| 33 |
allowaccess: |
| 34 |
type: list |
| 35 |
elements: str |
| 36 |
description: Control management access to the managed extender. |
| 37 |
choices: ['http', 'ssh', 'telnet', 'snmp', 'https', 'ping'] |
| 38 |
auth_server_address: |
| 39 |
aliases: ['auth-server-address'] |
| 40 |
type: str |
| 41 |
description: Wi-Fi Authentication Server Address |
| 42 |
auth_server_port: |
| 43 |
aliases: ['auth-server-port'] |
| 44 |
type: int |
| 45 |
description: Wi-Fi Authentication Server Port. |
| 46 |
auth_server_secret: |
| 47 |
aliases: ['auth-server-secret'] |
| 48 |
type: str |
| 49 |
description: Wi-Fi Authentication Server Secret. |
| 50 |
broadcast_ssid: |
| 51 |
aliases: ['broadcast-ssid'] |
| 52 |
type: str |
| 53 |
description: Wi-Fi broadcast SSID enable / disable. |
| 54 |
choices: ['disable', 'enable'] |
| 55 |
bss_color_partial: |
| 56 |
aliases: ['bss-color-partial'] |
| 57 |
type: str |
| 58 |
description: Wi-Fi 802. |
| 59 |
choices: ['disable', 'enable'] |
| 60 |
dtim: |
| 61 |
type: int |
| 62 |
description: Wi-Fi DTIM |
| 63 |
end_ip: |
| 64 |
aliases: ['end-ip'] |
| 65 |
type: str |
| 66 |
description: End ip address. |
| 67 |
ip_address: |
| 68 |
aliases: ['ip-address'] |
| 69 |
type: list |
| 70 |
elements: str |
| 71 |
description: Extender ip address. |
| 72 |
max_clients: |
| 73 |
aliases: ['max-clients'] |
| 74 |
type: int |
| 75 |
description: Wi-Fi max clients |
| 76 |
mu_mimo: |
| 77 |
aliases: ['mu-mimo'] |
| 78 |
type: str |
| 79 |
description: Wi-Fi multi-user MIMO enable / disable, default = enable. |
| 80 |
choices: ['disable', 'enable'] |
| 81 |
name: |
| 82 |
type: str |
| 83 |
description: Wi-Fi VAP name. |
| 84 |
required: true |
| 85 |
passphrase: |
| 86 |
type: list |
| 87 |
elements: str |
| 88 |
description: Wi-Fi passphrase. |
| 89 |
pmf: |
| 90 |
type: str |
| 91 |
description: Wi-Fi pmf enable/disable, default = disable. |
| 92 |
choices: ['disabled', 'optional', 'required'] |
| 93 |
rts_threshold: |
| 94 |
aliases: ['rts-threshold'] |
| 95 |
type: int |
| 96 |
description: Wi-Fi RTS Threshold |
| 97 |
sae_password: |
| 98 |
aliases: ['sae-password'] |
| 99 |
type: list |
| 100 |
elements: str |
| 101 |
description: Wi-Fi SAE Password. |
| 102 |
security: |
| 103 |
type: str |
| 104 |
description: Wi-Fi security. |
| 105 |
choices: ['OPEN', 'WPA2-Personal', 'WPA-WPA2-Personal', 'WPA3-SAE', |
| 106 |
'WPA3-SAE-Transition', 'WPA2-Enterprise', 'WPA3-Enterprise-only', |
| 107 |
'WPA3-Enterprise-transition', 'WPA3-Enterprise-192-bit'] |
| 108 |
ssid: |
| 109 |
type: str |
| 110 |
description: Wi-Fi SSID. |
| 111 |
start_ip: |
| 112 |
aliases: ['start-ip'] |
| 113 |
type: str |
| 114 |
description: Start ip address. |
| 115 |
target_wake_time: |
| 116 |
aliases: ['target-wake-time'] |
| 117 |
type: str |
| 118 |
description: Wi-Fi 802. |
| 119 |
choices: ['disable', 'enable'] |
| 120 |
type: |
| 121 |
type: str |
| 122 |
description: Wi-Fi VAP type local-vap / lan-extension-vap. |
| 123 |
choices: ['local-vap', 'lan-ext-vap'] |
| 124 |
''' |
| 125 |
|
| 126 |
EXAMPLES = ''' |
| 127 |
- name: Example playbook (generated based on argument schema) |
| 128 |
hosts: fortimanagers |
| 129 |
connection: httpapi |
| 130 |
gather_facts: false |
| 131 |
tasks: |
| 132 |
- name: FortiExtender wifi vap configuration. |
| 133 |
fortinet.fortimanager.fmgr_extensioncontroller_extendervap: |
| 134 |
# workspace_locking_adom: <global or your adom name> |
| 135 |
adom: <your own value> |
| 136 |
state: present # <value in [present, absent]> |
| 137 |
extensioncontroller_extendervap: |
| 138 |
name: "your value" # Required variable, string |
| 139 |
# allowaccess: ["http", "ssh", "telnet", "snmp", "https", "ping"] |
| 140 |
# auth_server_address: <string> |
| 141 |
# auth_server_port: <integer> |
| 142 |
# auth_server_secret: <string> |
| 143 |
# broadcast_ssid: <value in [disable, enable]> |
| 144 |
# bss_color_partial: <value in [disable, enable]> |
| 145 |
# dtim: <integer> |
| 146 |
# end_ip: <string> |
| 147 |
# ip_address: <list or string> |
| 148 |
# max_clients: <integer> |
| 149 |
# mu_mimo: <value in [disable, enable]> |
| 150 |
# passphrase: <list or string> |
| 151 |
# pmf: <value in [disabled, optional, required]> |
| 152 |
# rts_threshold: <integer> |
| 153 |
# sae_password: <list or string> |
| 154 |
# security: <value in [OPEN, WPA2-Personal, WPA-WPA2-Personal, ...]> |
| 155 |
# ssid: <string> |
| 156 |
# start_ip: <string> |
| 157 |
# target_wake_time: <value in [disable, enable]> |
| 158 |
# type: <value in [local-vap, lan-ext-vap]> |
| 159 |
''' |
| 160 |
|
| 161 |
RETURN = ''' |
| 162 |
meta: |
| 163 |
description: The result of the request. |
| 164 |
type: dict |
| 165 |
returned: always |
| 166 |
contains: |
| 167 |
request_url: |
| 168 |
description: The full url requested. |
| 169 |
returned: always |
| 170 |
type: str |
| 171 |
sample: /sys/login/user |
| 172 |
response_code: |
| 173 |
description: The status of api request. |
| 174 |
returned: always |
| 175 |
type: int |
| 176 |
sample: 0 |
| 177 |
response_data: |
| 178 |
description: The api response. |
| 179 |
type: list |
| 180 |
returned: always |
| 181 |
response_message: |
| 182 |
description: The descriptive message of the api response. |
| 183 |
type: str |
| 184 |
returned: always |
| 185 |
sample: OK. |
| 186 |
system_information: |
| 187 |
description: The information of the target system. |
| 188 |
type: dict |
| 189 |
returned: always |
| 190 |
rc: |
| 191 |
description: The status the request. |
| 192 |
type: int |
| 193 |
returned: always |
| 194 |
sample: 0 |
| 195 |
version_check_warning: |
| 196 |
description: Warning if the parameters used in the playbook are not supported by the current FortiManager version. |
| 197 |
type: list |
| 198 |
returned: complex |
| 199 |
''' |
| 200 |
from ansible.module_utils.basic import AnsibleModule |
| 201 |
from ansible.module_utils.connection import Connection |
| 202 |
from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass |
| 203 |
from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec |
| 204 |
|
| 205 |
|
| 206 |
def main(): |
| 207 |
urls_list = [ |
| 208 |
'/pm/config/adom/{adom}/obj/extension-controller/extender-vap', |
| 209 |
'/pm/config/global/obj/extension-controller/extender-vap' |
| 210 |
] |
| 211 |
module_arg_spec = { |
| 212 |
'adom': {'required': True, 'type': 'str'}, |
| 213 |
'revision_note': {'type': 'str'}, |
| 214 |
'extensioncontroller_extendervap': { |
| 215 |
'type': 'dict', 'v_range': [['7.4.7', '7.4.10'], ['7.6.3', '']], |
| 216 |
'options': { |
| 217 |
'allowaccess': { |
| 218 |
'v_range': [['7.4.7', '7.4.10'], ['7.6.3', '']], |
| 219 |
'type': 'list', |
| 220 |
'choices': ['http', 'ssh', 'telnet', 'snmp', 'https', 'ping'], |
| 221 |
'elements': 'str' |
| 222 |
}, |
| 223 |
'auth-server-address': {'v_range': [['7.4.7', '7.4.10'], ['7.6.3', '']], 'type': 'str'}, |
| 224 |
'auth-server-port': {'v_range': [['7.4.7', '7.4.10'], ['7.6.3', '']], 'type': 'int'}, |
| 225 |
'auth-server-secret': {'v_range': [['7.4.7', '7.4.10'], ['7.6.3', '']], 'no_log': True, 'type': 'str'}, |
| 226 |
'broadcast-ssid': {'v_range': [['7.4.7', '7.4.10'], ['7.6.3', '']], 'choices': ['disable', 'enable'], 'type': 'str'}, |
| 227 |
'bss-color-partial': {'v_range': [['7.4.7', '7.4.10'], ['7.6.3', '']], 'choices': ['disable', 'enable'], 'type': 'str'}, |
| 228 |
'dtim': {'v_range': [['7.4.7', '7.4.10'], ['7.6.3', '']], 'type': 'int'}, |
| 229 |
'end-ip': {'v_range': [['7.4.7', '7.4.10'], ['7.6.3', '']], 'type': 'str'}, |
| 230 |
'ip-address': {'v_range': [['7.4.7', '7.4.10'], ['7.6.3', '']], 'type': 'list', 'elements': 'str'}, |
| 231 |
'max-clients': {'v_range': [['7.4.7', '7.4.10'], ['7.6.3', '']], 'type': 'int'}, |
| 232 |
'mu-mimo': {'v_range': [['7.4.7', '7.4.10'], ['7.6.3', '']], 'choices': ['disable', 'enable'], 'type': 'str'}, |
| 233 |
'name': {'v_range': [['7.4.7', '7.4.10'], ['7.6.3', '']], 'required': True, 'type': 'str'}, |
| 234 |
'passphrase': {'v_range': [['7.4.7', '7.4.10'], ['7.6.3', '']], 'no_log': True, 'type': 'list', 'elements': 'str'}, |
| 235 |
'pmf': {'v_range': [['7.4.7', '7.4.10'], ['7.6.3', '']], 'choices': ['disabled', 'optional', 'required'], 'type': 'str'}, |
| 236 |
'rts-threshold': {'v_range': [['7.4.7', '7.4.10'], ['7.6.3', '']], 'type': 'int'}, |
| 237 |
'sae-password': {'v_range': [['7.4.7', '7.4.10'], ['7.6.3', '']], 'no_log': True, 'type': 'list', 'elements': 'str'}, |
| 238 |
'security': { |
| 239 |
'v_range': [['7.4.7', '7.4.10'], ['7.6.3', '']], |
| 240 |
'choices': [ |
| 241 |
'OPEN', 'WPA2-Personal', 'WPA-WPA2-Personal', 'WPA3-SAE', 'WPA3-SAE-Transition', 'WPA2-Enterprise', 'WPA3-Enterprise-only', |
| 242 |
'WPA3-Enterprise-transition', 'WPA3-Enterprise-192-bit' |
| 243 |
], |
| 244 |
'type': 'str' |
| 245 |
}, |
| 246 |
'ssid': {'v_range': [['7.4.7', '7.4.10'], ['7.6.3', '']], 'type': 'str'}, |
| 247 |
'start-ip': {'v_range': [['7.4.7', '7.4.10'], ['7.6.3', '']], 'type': 'str'}, |
| 248 |
'target-wake-time': {'v_range': [['7.4.7', '7.4.10'], ['7.6.3', '']], 'choices': ['disable', 'enable'], 'type': 'str'}, |
| 249 |
'type': {'v_range': [['7.4.7', '7.4.10'], ['7.6.3', '']], 'choices': ['local-vap', 'lan-ext-vap'], 'type': 'str'} |
| 250 |
} |
| 251 |
} |
| 252 |
} |
| 253 |
|
| 254 |
module_option_spec = get_module_arg_spec('full crud') |
| 255 |
module_arg_spec.update(module_option_spec) |
| 256 |
check_galaxy_version(module_arg_spec) |
| 257 |
module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'extensioncontroller_extendervap'), |
| 258 |
supports_check_mode=True) |
| 259 |
if not module._socket_path: |
| 260 |
module.fail_json(msg='MUST RUN IN HTTPAPI MODE') |
| 261 |
connection = Connection(module._socket_path) |
| 262 |
fmgr = NAPIManager('full crud', module_arg_spec, urls_list, |
| 263 |
'name', 'data', module, connection) |
| 264 |
fmgr.process_crud() |
| 265 |
module.exit_json(meta=module.params) |
| 266 |
|
| 267 |
|
| 268 |
if __name__ == '__main__': |
| 269 |
main() |