| 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_user_fssopolling |
| 15 |
short_description: Configure FSSO active directory servers for polling mode. |
| 16 |
version_added: "2.0.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 |
user_fssopolling: |
| 29 |
description: The top level parameters set. |
| 30 |
required: false |
| 31 |
type: dict |
| 32 |
suboptions: |
| 33 |
_gui_meta: |
| 34 |
type: str |
| 35 |
description: Gui meta. |
| 36 |
adgrp: |
| 37 |
type: list |
| 38 |
elements: dict |
| 39 |
description: Adgrp. |
| 40 |
suboptions: |
| 41 |
name: |
| 42 |
type: str |
| 43 |
description: Name. |
| 44 |
default_domain: |
| 45 |
aliases: ['default-domain'] |
| 46 |
type: str |
| 47 |
description: Default domain managed by this Active Directory server. |
| 48 |
id: |
| 49 |
type: int |
| 50 |
description: Active Directory server ID. |
| 51 |
required: true |
| 52 |
ldap_server: |
| 53 |
aliases: ['ldap-server'] |
| 54 |
type: str |
| 55 |
description: LDAP server name used in LDAP connection strings. |
| 56 |
logon_history: |
| 57 |
aliases: ['logon-history'] |
| 58 |
type: int |
| 59 |
description: Number of hours of logon history to keep, 0 means keep all history. |
| 60 |
password: |
| 61 |
type: raw |
| 62 |
description: (list) Password required to log into this Active Directory server |
| 63 |
polling_frequency: |
| 64 |
aliases: ['polling-frequency'] |
| 65 |
type: int |
| 66 |
description: Polling frequency |
| 67 |
port: |
| 68 |
type: int |
| 69 |
description: Port to communicate with this Active Directory server. |
| 70 |
server: |
| 71 |
type: str |
| 72 |
description: Host name or IP address of the Active Directory server. |
| 73 |
status: |
| 74 |
type: str |
| 75 |
description: Enable/disable polling for the status of this Active Directory server. |
| 76 |
choices: ['disable', 'enable'] |
| 77 |
user: |
| 78 |
type: str |
| 79 |
description: User name required to log into this Active Directory server. |
| 80 |
smb_ntlmv1_auth: |
| 81 |
aliases: ['smb-ntlmv1-auth'] |
| 82 |
type: str |
| 83 |
description: Enable/disable support of NTLMv1 for Samba authentication. |
| 84 |
choices: ['disable', 'enable'] |
| 85 |
smbv1: |
| 86 |
type: str |
| 87 |
description: Enable/disable support of SMBv1 for Samba. |
| 88 |
choices: ['disable', 'enable'] |
| 89 |
''' |
| 90 |
|
| 91 |
EXAMPLES = ''' |
| 92 |
- name: Example playbook |
| 93 |
hosts: fortimanagers |
| 94 |
gather_facts: false |
| 95 |
connection: httpapi |
| 96 |
vars: |
| 97 |
ansible_httpapi_use_ssl: true |
| 98 |
ansible_httpapi_validate_certs: false |
| 99 |
ansible_httpapi_port: 443 |
| 100 |
tasks: |
| 101 |
- name: Configure FSSO active directory servers for polling mode. |
| 102 |
fortinet.fortimanager.fmgr_user_fssopolling: |
| 103 |
bypass_validation: false |
| 104 |
adom: ansible |
| 105 |
state: present |
| 106 |
user_fssopolling: |
| 107 |
id: 1 |
| 108 |
password: fortinet |
| 109 |
port: 8000 |
| 110 |
server: ansible |
| 111 |
status: disable |
| 112 |
|
| 113 |
- name: Gathering fortimanager facts |
| 114 |
hosts: fortimanagers |
| 115 |
gather_facts: false |
| 116 |
connection: httpapi |
| 117 |
vars: |
| 118 |
ansible_httpapi_use_ssl: true |
| 119 |
ansible_httpapi_validate_certs: false |
| 120 |
ansible_httpapi_port: 443 |
| 121 |
tasks: |
| 122 |
- name: Retrieve all the FSSO active directory servers for polling mode |
| 123 |
fortinet.fortimanager.fmgr_fact: |
| 124 |
facts: |
| 125 |
selector: "user_fssopolling" |
| 126 |
params: |
| 127 |
adom: "ansible" |
| 128 |
fsso_polling: "your_value" |
| 129 |
''' |
| 130 |
|
| 131 |
RETURN = ''' |
| 132 |
meta: |
| 133 |
description: The result of the request. |
| 134 |
type: dict |
| 135 |
returned: always |
| 136 |
contains: |
| 137 |
request_url: |
| 138 |
description: The full url requested. |
| 139 |
returned: always |
| 140 |
type: str |
| 141 |
sample: /sys/login/user |
| 142 |
response_code: |
| 143 |
description: The status of api request. |
| 144 |
returned: always |
| 145 |
type: int |
| 146 |
sample: 0 |
| 147 |
response_data: |
| 148 |
description: The api response. |
| 149 |
type: list |
| 150 |
returned: always |
| 151 |
response_message: |
| 152 |
description: The descriptive message of the api response. |
| 153 |
type: str |
| 154 |
returned: always |
| 155 |
sample: OK. |
| 156 |
system_information: |
| 157 |
description: The information of the target system. |
| 158 |
type: dict |
| 159 |
returned: always |
| 160 |
rc: |
| 161 |
description: The status the request. |
| 162 |
type: int |
| 163 |
returned: always |
| 164 |
sample: 0 |
| 165 |
version_check_warning: |
| 166 |
description: Warning if the parameters used in the playbook are not supported by the current FortiManager version. |
| 167 |
type: list |
| 168 |
returned: complex |
| 169 |
''' |
| 170 |
from ansible.module_utils.basic import AnsibleModule |
| 171 |
from ansible.module_utils.connection import Connection |
| 172 |
from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass |
| 173 |
from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec |
| 174 |
|
| 175 |
|
| 176 |
def main(): |
| 177 |
urls_list = [ |
| 178 |
'/pm/config/adom/{adom}/obj/user/fsso-polling', |
| 179 |
'/pm/config/global/obj/user/fsso-polling' |
| 180 |
] |
| 181 |
module_arg_spec = { |
| 182 |
'adom': {'required': True, 'type': 'str'}, |
| 183 |
'revision_note': {'type': 'str'}, |
| 184 |
'user_fssopolling': { |
| 185 |
'type': 'dict', 'v_range': [['6.0.0', '']], |
| 186 |
'options': { |
| 187 |
'_gui_meta': {'type': 'str'}, |
| 188 |
'adgrp': {'type': 'list', 'options': {'name': {'type': 'str'}}, 'elements': 'dict'}, |
| 189 |
'default-domain': {'type': 'str'}, |
| 190 |
'id': {'required': True, 'type': 'int'}, |
| 191 |
'ldap-server': {'type': 'str'}, |
| 192 |
'logon-history': {'type': 'int'}, |
| 193 |
'password': {'no_log': True, 'type': 'raw'}, |
| 194 |
'polling-frequency': {'type': 'int'}, |
| 195 |
'port': {'type': 'int'}, |
| 196 |
'server': {'type': 'str'}, |
| 197 |
'status': {'choices': ['disable', 'enable'], 'type': 'str'}, |
| 198 |
'user': {'type': 'str'}, |
| 199 |
'smb-ntlmv1-auth': {'v_range': [['6.2.0', '']], 'choices': ['disable', 'enable'], 'type': 'str'}, |
| 200 |
'smbv1': {'v_range': [['6.2.0', '']], 'choices': ['disable', 'enable'], 'type': 'str'} |
| 201 |
} |
| 202 |
} |
| 203 |
} |
| 204 |
|
| 205 |
module_option_spec = get_module_arg_spec('full crud') |
| 206 |
module_arg_spec.update(module_option_spec) |
| 207 |
check_galaxy_version(module_arg_spec) |
| 208 |
module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'user_fssopolling'), |
| 209 |
supports_check_mode=True) |
| 210 |
if not module._socket_path: |
| 211 |
module.fail_json(msg='MUST RUN IN HTTPAPI MODE') |
| 212 |
connection = Connection(module._socket_path) |
| 213 |
fmgr = NAPIManager('full crud', module_arg_spec, urls_list, |
| 214 |
'id', 'data', module, connection) |
| 215 |
fmgr.process_crud() |
| 216 |
module.exit_json(meta=module.params) |
| 217 |
|
| 218 |
|
| 219 |
if __name__ == '__main__': |
| 220 |
main() |