| 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_mpskprofile_mpskgroup_mpskkey |
| 15 |
short_description: List of multiple PSK entries. |
| 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 |
mpsk-profile: |
| 29 |
description: Deprecated, please use "mpsk_profile" |
| 30 |
type: str |
| 31 |
mpsk_profile: |
| 32 |
description: The parameter (mpsk-profile) in requested url. |
| 33 |
type: str |
| 34 |
mpsk-group: |
| 35 |
description: Deprecated, please use "mpsk_group" |
| 36 |
type: str |
| 37 |
mpsk_group: |
| 38 |
description: The parameter (mpsk-group) in requested url. |
| 39 |
type: str |
| 40 |
mpskprofile_mpskgroup_mpskkey: |
| 41 |
description: The top level parameters set. |
| 42 |
required: false |
| 43 |
type: dict |
| 44 |
suboptions: |
| 45 |
comment: |
| 46 |
type: str |
| 47 |
description: Comment. |
| 48 |
concurrent_client_limit_type: |
| 49 |
aliases: ['concurrent-client-limit-type'] |
| 50 |
type: str |
| 51 |
description: MPSK client limit type options. |
| 52 |
choices: ['default', 'unlimited', 'specified'] |
| 53 |
concurrent_clients: |
| 54 |
aliases: ['concurrent-clients'] |
| 55 |
type: int |
| 56 |
description: Number of clients that can connect using this pre-shared key |
| 57 |
mac: |
| 58 |
type: str |
| 59 |
description: MAC address. |
| 60 |
mpsk_schedules: |
| 61 |
aliases: ['mpsk-schedules'] |
| 62 |
type: raw |
| 63 |
description: (list or str) Firewall schedule for MPSK passphrase. |
| 64 |
name: |
| 65 |
type: str |
| 66 |
description: Pre-shared key name. |
| 67 |
required: true |
| 68 |
passphrase: |
| 69 |
type: raw |
| 70 |
description: (list) WPA Pre-shared key. |
| 71 |
pmk: |
| 72 |
type: raw |
| 73 |
description: (list) WPA PMK. |
| 74 |
key_type: |
| 75 |
aliases: ['key-type'] |
| 76 |
type: str |
| 77 |
description: Select the type of the key. |
| 78 |
choices: ['wpa2-personal', 'wpa3-sae'] |
| 79 |
sae_password: |
| 80 |
aliases: ['sae-password'] |
| 81 |
type: raw |
| 82 |
description: (list) WPA3 SAE password. |
| 83 |
sae_pk: |
| 84 |
aliases: ['sae-pk'] |
| 85 |
type: str |
| 86 |
description: Enable/disable WPA3 SAE-PK |
| 87 |
choices: ['disable', 'enable'] |
| 88 |
sae_private_key: |
| 89 |
aliases: ['sae-private-key'] |
| 90 |
type: str |
| 91 |
description: Private key used for WPA3 SAE-PK authentication. |
| 92 |
''' |
| 93 |
|
| 94 |
EXAMPLES = ''' |
| 95 |
- name: Example playbook (generated based on argument schema) |
| 96 |
hosts: fortimanagers |
| 97 |
connection: httpapi |
| 98 |
gather_facts: false |
| 99 |
tasks: |
| 100 |
- name: List of multiple PSK entries. |
| 101 |
fortinet.fortimanager.fmgr_mpskprofile_mpskgroup_mpskkey: |
| 102 |
# workspace_locking_adom: <global or your adom name> |
| 103 |
adom: <your own value> |
| 104 |
mpsk_profile: <your own value> |
| 105 |
mpsk_group: <your own value> |
| 106 |
state: present # <value in [present, absent]> |
| 107 |
mpskprofile_mpskgroup_mpskkey: |
| 108 |
name: "your value" # Required variable, string |
| 109 |
# comment: <string> |
| 110 |
# concurrent_client_limit_type: <value in [default, unlimited, specified]> |
| 111 |
# concurrent_clients: <integer> |
| 112 |
# mac: <string> |
| 113 |
# mpsk_schedules: <list or string> |
| 114 |
# passphrase: <list or string> |
| 115 |
# pmk: <list or string> |
| 116 |
# key_type: <value in [wpa2-personal, wpa3-sae]> |
| 117 |
# sae_password: <list or string> |
| 118 |
# sae_pk: <value in [disable, enable]> |
| 119 |
# sae_private_key: <string> |
| 120 |
''' |
| 121 |
|
| 122 |
RETURN = ''' |
| 123 |
meta: |
| 124 |
description: The result of the request. |
| 125 |
type: dict |
| 126 |
returned: always |
| 127 |
contains: |
| 128 |
request_url: |
| 129 |
description: The full url requested. |
| 130 |
returned: always |
| 131 |
type: str |
| 132 |
sample: /sys/login/user |
| 133 |
response_code: |
| 134 |
description: The status of api request. |
| 135 |
returned: always |
| 136 |
type: int |
| 137 |
sample: 0 |
| 138 |
response_data: |
| 139 |
description: The api response. |
| 140 |
type: list |
| 141 |
returned: always |
| 142 |
response_message: |
| 143 |
description: The descriptive message of the api response. |
| 144 |
type: str |
| 145 |
returned: always |
| 146 |
sample: OK. |
| 147 |
system_information: |
| 148 |
description: The information of the target system. |
| 149 |
type: dict |
| 150 |
returned: always |
| 151 |
rc: |
| 152 |
description: The status the request. |
| 153 |
type: int |
| 154 |
returned: always |
| 155 |
sample: 0 |
| 156 |
version_check_warning: |
| 157 |
description: Warning if the parameters used in the playbook are not supported by the current FortiManager version. |
| 158 |
type: list |
| 159 |
returned: complex |
| 160 |
''' |
| 161 |
from ansible.module_utils.basic import AnsibleModule |
| 162 |
from ansible.module_utils.connection import Connection |
| 163 |
from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass |
| 164 |
from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec |
| 165 |
|
| 166 |
|
| 167 |
def main(): |
| 168 |
urls_list = [ |
| 169 |
'/pm/config/adom/{adom}/obj/wireless-controller/mpsk-profile/{mpsk-profile}/mpsk-group/{mpsk-group}/mpsk-key', |
| 170 |
'/pm/config/global/obj/wireless-controller/mpsk-profile/{mpsk-profile}/mpsk-group/{mpsk-group}/mpsk-key' |
| 171 |
] |
| 172 |
module_arg_spec = { |
| 173 |
'adom': {'required': True, 'type': 'str'}, |
| 174 |
'mpsk-profile': {'type': 'str', 'api_name': 'mpsk_profile'}, |
| 175 |
'mpsk_profile': {'type': 'str'}, |
| 176 |
'mpsk-group': {'type': 'str', 'api_name': 'mpsk_group'}, |
| 177 |
'mpsk_group': {'type': 'str'}, |
| 178 |
'revision_note': {'type': 'str'}, |
| 179 |
'mpskprofile_mpskgroup_mpskkey': { |
| 180 |
'type': 'dict', 'v_range': [['6.4.2', '']], 'no_log': False, |
| 181 |
'options': { |
| 182 |
'comment': {'v_range': [['6.4.2', '']], 'type': 'str'}, |
| 183 |
'concurrent-client-limit-type': {'v_range': [['6.4.2', '']], 'choices': ['default', 'unlimited', 'specified'], 'type': 'str'}, |
| 184 |
'concurrent-clients': {'v_range': [['6.4.2', '']], 'type': 'int'}, |
| 185 |
'mac': {'v_range': [['6.4.2', '']], 'type': 'str'}, |
| 186 |
'mpsk-schedules': {'v_range': [['6.4.2', '']], 'type': 'raw'}, |
| 187 |
'name': {'v_range': [['6.4.2', '']], 'required': True, 'type': 'str'}, |
| 188 |
'passphrase': {'v_range': [['6.4.2', '']], 'no_log': True, 'type': 'raw'}, |
| 189 |
'pmk': {'v_range': [['6.4.2', '']], 'type': 'raw'}, |
| 190 |
'key-type': {'v_range': [['7.4.3', '']], 'choices': ['wpa2-personal', 'wpa3-sae'], 'type': 'str'}, |
| 191 |
'sae-password': {'v_range': [['7.4.3', '']], 'no_log': True, 'type': 'raw'}, |
| 192 |
'sae-pk': {'v_range': [['7.4.3', '']], 'choices': ['disable', 'enable'], 'type': 'str'}, |
| 193 |
'sae-private-key': {'v_range': [['7.4.3', '']], 'no_log': True, 'type': 'str'} |
| 194 |
} |
| 195 |
} |
| 196 |
} |
| 197 |
|
| 198 |
module_option_spec = get_module_arg_spec('full crud') |
| 199 |
module_arg_spec.update(module_option_spec) |
| 200 |
check_galaxy_version(module_arg_spec) |
| 201 |
module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'mpskprofile_mpskgroup_mpskkey'), |
| 202 |
supports_check_mode=True) |
| 203 |
if not module._socket_path: |
| 204 |
module.fail_json(msg='MUST RUN IN HTTPAPI MODE') |
| 205 |
connection = Connection(module._socket_path) |
| 206 |
fmgr = NAPIManager('full crud', module_arg_spec, urls_list, |
| 207 |
'name', 'data', module, connection) |
| 208 |
fmgr.process_crud() |
| 209 |
module.exit_json(meta=module.params) |
| 210 |
|
| 211 |
|
| 212 |
if __name__ == '__main__': |
| 213 |
main() |