| 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_dvmdb_adom |
| 15 |
short_description: ADOM table, most attributes are read-only and can only be changed internally. |
| 16 |
version_added: "2.0.0" |
| 17 |
extends_documentation_fragment: |
| 18 |
- fortinet.fortimanager.general |
| 19 |
- fortinet.fortimanager.general.full_crud |
| 20 |
options: |
| 21 |
dvmdb_adom: |
| 22 |
description: The top level parameters set. |
| 23 |
required: false |
| 24 |
type: dict |
| 25 |
suboptions: |
| 26 |
desc: |
| 27 |
type: str |
| 28 |
description: Desc. |
| 29 |
flags: |
| 30 |
type: list |
| 31 |
elements: str |
| 32 |
description: Flags. |
| 33 |
choices: ['migration', 'db_export', 'no_vpn_console', 'backup', 'other_devices', |
| 34 |
'central_sdwan', 'is_autosync', 'per_device_wtp', |
| 35 |
'policy_check_on_install', 'install_on_policy_check_fail', |
| 36 |
'auto_push_cfg', 'per_device_fsw', 'install_deselect_all'] |
| 37 |
log_db_retention_hours: |
| 38 |
type: int |
| 39 |
description: Log db retention hours. |
| 40 |
log_disk_quota: |
| 41 |
type: int |
| 42 |
description: Log disk quota. |
| 43 |
log_disk_quota_alert_thres: |
| 44 |
type: int |
| 45 |
description: Log disk quota alert thres. |
| 46 |
log_disk_quota_split_ratio: |
| 47 |
type: int |
| 48 |
description: Log disk quota split ratio. |
| 49 |
log_file_retention_hours: |
| 50 |
type: int |
| 51 |
description: Log file retention hours. |
| 52 |
meta_fields: |
| 53 |
aliases: ['meta fields'] |
| 54 |
type: dict |
| 55 |
description: Default metafields |
| 56 |
mig_mr: |
| 57 |
type: int |
| 58 |
description: Mig mr. |
| 59 |
mig_os_ver: |
| 60 |
type: str |
| 61 |
description: Mig os ver. |
| 62 |
choices: ['unknown', '0.0', '1.0', '2.0', '3.0', '4.0', '5.0', '6.0', '7.0', |
| 63 |
'8.0', '9.0'] |
| 64 |
mode: |
| 65 |
type: str |
| 66 |
description: |
| 67 |
- ems - |
| 68 |
- provider - Global database. |
| 69 |
choices: ['ems', 'gms', 'provider'] |
| 70 |
mr: |
| 71 |
type: int |
| 72 |
description: Mr. |
| 73 |
name: |
| 74 |
type: str |
| 75 |
description: Name. |
| 76 |
required: true |
| 77 |
os_ver: |
| 78 |
type: str |
| 79 |
description: Os ver. |
| 80 |
choices: ['unknown', '0.0', '1.0', '2.0', '3.0', '4.0', '5.0', '6.0', '7.0', |
| 81 |
'8.0', '9.0'] |
| 82 |
restricted_prds: |
| 83 |
type: raw |
| 84 |
description: (list or str) Restricted prds. |
| 85 |
choices: ['fos', 'foc', 'fml', 'fch', 'fwb', 'log', 'fct', 'faz', 'fsa', 'fsw', |
| 86 |
'fmg', 'fdd', 'fac', 'fpx', 'fna', 'fdc', 'ffw', 'fsr', 'fad', 'fap', |
| 87 |
'fxt', 'fts', 'fai', 'fwc', 'fis', 'fed', 'fabric', 'fpa', 'fca', 'ftc', |
| 88 |
'fss', 'sim', 'fra'] |
| 89 |
state: |
| 90 |
type: int |
| 91 |
description: State. |
| 92 |
uuid: |
| 93 |
type: str |
| 94 |
description: Uuid. |
| 95 |
create_time: |
| 96 |
type: int |
| 97 |
description: Create time. |
| 98 |
workspace_mode: |
| 99 |
type: int |
| 100 |
description: Workspace mode. |
| 101 |
tz: |
| 102 |
type: int |
| 103 |
description: Tz. |
| 104 |
lock_override: |
| 105 |
type: int |
| 106 |
description: Lock override. |
| 107 |
primary_dns_ip4: |
| 108 |
type: str |
| 109 |
description: Primary dns ip4. |
| 110 |
primary_dns_ip6_1: |
| 111 |
type: int |
| 112 |
description: Primary dns ip6 1. |
| 113 |
primary_dns_ip6_2: |
| 114 |
type: int |
| 115 |
description: Primary dns ip6 2. |
| 116 |
primary_dns_ip6_3: |
| 117 |
type: int |
| 118 |
description: Primary dns ip6 3. |
| 119 |
primary_dns_ip6_4: |
| 120 |
type: int |
| 121 |
description: Primary dns ip6 4. |
| 122 |
secondary_dns_ip4: |
| 123 |
type: str |
| 124 |
description: Secondary dns ip4. |
| 125 |
secondary_dns_ip6_1: |
| 126 |
type: int |
| 127 |
description: Secondary dns ip6 1. |
| 128 |
secondary_dns_ip6_2: |
| 129 |
type: int |
| 130 |
description: Secondary dns ip6 2. |
| 131 |
secondary_dns_ip6_3: |
| 132 |
type: int |
| 133 |
description: Secondary dns ip6 3. |
| 134 |
secondary_dns_ip6_4: |
| 135 |
type: int |
| 136 |
description: Secondary dns ip6 4. |
| 137 |
''' |
| 138 |
|
| 139 |
EXAMPLES = ''' |
| 140 |
- name: Example playbook (generated based on argument schema) |
| 141 |
hosts: fortimanagers |
| 142 |
connection: httpapi |
| 143 |
gather_facts: false |
| 144 |
tasks: |
| 145 |
- name: ADOM table, most attributes are read-only and can only be changed internally. |
| 146 |
fortinet.fortimanager.fmgr_dvmdb_adom: |
| 147 |
# workspace_locking_adom: <global or your adom name> |
| 148 |
state: present # <value in [present, absent]> |
| 149 |
dvmdb_adom: |
| 150 |
name: "your value" # Required variable, string |
| 151 |
# desc: <string> |
| 152 |
# flags: ["migration", "db_export", "no_vpn_console", "backup", "other_devices", |
| 153 |
# "central_sdwan", "is_autosync", "per_device_wtp", "policy_check_on_install", |
| 154 |
# "install_on_policy_check_fail", "auto_push_cfg", "per_device_fsw", |
| 155 |
# "install_deselect_all"] |
| 156 |
# log_db_retention_hours: <integer> |
| 157 |
# log_disk_quota: <integer> |
| 158 |
# log_disk_quota_alert_thres: <integer> |
| 159 |
# log_disk_quota_split_ratio: <integer> |
| 160 |
# log_file_retention_hours: <integer> |
| 161 |
# meta_fields: <dict> |
| 162 |
# mig_mr: <integer> |
| 163 |
# mig_os_ver: <value in [unknown, 0.0, 1.0, ...]> |
| 164 |
# mode: <value in [ems, gms, provider]> |
| 165 |
# mr: <integer> |
| 166 |
# os_ver: <value in [unknown, 0.0, 1.0, ...]> |
| 167 |
# restricted_prds: ["fos", "foc", "fml", "fch", "fwb", "log", "fct", "faz", "fsa", |
| 168 |
# "fsw", "fmg", "fdd", "fac", "fpx", "fna", "fdc", "ffw", "fsr", |
| 169 |
# "fad", "fap", "fxt", "fts", "fai", "fwc", "fis", "fed", "fabric", |
| 170 |
# "fpa", "fca", "ftc", "fss", "sim", "fra"] |
| 171 |
# state: <integer> |
| 172 |
# uuid: <string> |
| 173 |
# create_time: <integer> |
| 174 |
# workspace_mode: <integer> |
| 175 |
# tz: <integer> |
| 176 |
# lock_override: <integer> |
| 177 |
# primary_dns_ip4: <string> |
| 178 |
# primary_dns_ip6_1: <integer> |
| 179 |
# primary_dns_ip6_2: <integer> |
| 180 |
# primary_dns_ip6_3: <integer> |
| 181 |
# primary_dns_ip6_4: <integer> |
| 182 |
# secondary_dns_ip4: <string> |
| 183 |
# secondary_dns_ip6_1: <integer> |
| 184 |
# secondary_dns_ip6_2: <integer> |
| 185 |
# secondary_dns_ip6_3: <integer> |
| 186 |
# secondary_dns_ip6_4: <integer> |
| 187 |
''' |
| 188 |
|
| 189 |
RETURN = ''' |
| 190 |
meta: |
| 191 |
description: The result of the request. |
| 192 |
type: dict |
| 193 |
returned: always |
| 194 |
contains: |
| 195 |
request_url: |
| 196 |
description: The full url requested. |
| 197 |
returned: always |
| 198 |
type: str |
| 199 |
sample: /sys/login/user |
| 200 |
response_code: |
| 201 |
description: The status of api request. |
| 202 |
returned: always |
| 203 |
type: int |
| 204 |
sample: 0 |
| 205 |
response_data: |
| 206 |
description: The api response. |
| 207 |
type: list |
| 208 |
returned: always |
| 209 |
response_message: |
| 210 |
description: The descriptive message of the api response. |
| 211 |
type: str |
| 212 |
returned: always |
| 213 |
sample: OK. |
| 214 |
system_information: |
| 215 |
description: The information of the target system. |
| 216 |
type: dict |
| 217 |
returned: always |
| 218 |
rc: |
| 219 |
description: The status the request. |
| 220 |
type: int |
| 221 |
returned: always |
| 222 |
sample: 0 |
| 223 |
version_check_warning: |
| 224 |
description: Warning if the parameters used in the playbook are not supported by the current FortiManager version. |
| 225 |
type: list |
| 226 |
returned: complex |
| 227 |
''' |
| 228 |
from ansible.module_utils.basic import AnsibleModule |
| 229 |
from ansible.module_utils.connection import Connection |
| 230 |
from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass |
| 231 |
from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec |
| 232 |
|
| 233 |
|
| 234 |
def main(): |
| 235 |
urls_list = [ |
| 236 |
'/dvmdb/adom' |
| 237 |
] |
| 238 |
module_arg_spec = { |
| 239 |
'dvmdb_adom': { |
| 240 |
'type': 'dict', 'v_range': [['6.0.0', '']], |
| 241 |
'options': { |
| 242 |
'desc': {'type': 'str'}, |
| 243 |
'flags': { |
| 244 |
'type': 'list', |
| 245 |
'choices': [ |
| 246 |
'migration', 'db_export', 'no_vpn_console', 'backup', 'other_devices', 'central_sdwan', 'is_autosync', 'per_device_wtp', |
| 247 |
'policy_check_on_install', 'install_on_policy_check_fail', 'auto_push_cfg', 'per_device_fsw', 'install_deselect_all' |
| 248 |
], |
| 249 |
'elements': 'str' |
| 250 |
}, |
| 251 |
'log_db_retention_hours': {'type': 'int'}, |
| 252 |
'log_disk_quota': {'type': 'int'}, |
| 253 |
'log_disk_quota_alert_thres': {'type': 'int'}, |
| 254 |
'log_disk_quota_split_ratio': {'type': 'int'}, |
| 255 |
'log_file_retention_hours': {'type': 'int'}, |
| 256 |
'meta fields': {'type': 'dict'}, |
| 257 |
'mig_mr': {'type': 'int'}, |
| 258 |
'mig_os_ver': {'choices': ['unknown', '0.0', '1.0', '2.0', '3.0', '4.0', '5.0', '6.0', '7.0', '8.0', '9.0'], 'type': 'str'}, |
| 259 |
'mode': {'choices': ['ems', 'gms', 'provider'], 'type': 'str'}, |
| 260 |
'mr': {'type': 'int'}, |
| 261 |
'name': {'required': True, 'type': 'str'}, |
| 262 |
'os_ver': {'choices': ['unknown', '0.0', '1.0', '2.0', '3.0', '4.0', '5.0', '6.0', '7.0', '8.0', '9.0'], 'type': 'str'}, |
| 263 |
'restricted_prds': { |
| 264 |
'type': 'raw', |
| 265 |
'choices': [ |
| 266 |
'fos', 'foc', 'fml', 'fch', 'fwb', 'log', 'fct', 'faz', 'fsa', 'fsw', 'fmg', 'fdd', 'fac', 'fpx', 'fna', 'fdc', 'ffw', 'fsr', |
| 267 |
'fad', 'fap', 'fxt', 'fts', 'fai', 'fwc', 'fis', 'fed', 'fabric', 'fpa', 'fca', 'ftc', 'fss', 'sim', 'fra' |
| 268 |
] |
| 269 |
}, |
| 270 |
'state': {'type': 'int'}, |
| 271 |
'uuid': {'type': 'str'}, |
| 272 |
'create_time': {'v_range': [['6.4.1', '']], 'type': 'int'}, |
| 273 |
'workspace_mode': {'v_range': [['6.4.3', '']], 'type': 'int'}, |
| 274 |
'tz': {'v_range': [['7.4.0', '']], 'type': 'int'}, |
| 275 |
'lock_override': {'v_range': [['7.4.1', '']], 'type': 'int'}, |
| 276 |
'primary_dns_ip4': {'v_range': [['7.4.3', '']], 'type': 'str'}, |
| 277 |
'primary_dns_ip6_1': {'v_range': [['7.4.3', '']], 'type': 'int'}, |
| 278 |
'primary_dns_ip6_2': {'v_range': [['7.4.3', '']], 'type': 'int'}, |
| 279 |
'primary_dns_ip6_3': {'v_range': [['7.4.3', '']], 'type': 'int'}, |
| 280 |
'primary_dns_ip6_4': {'v_range': [['7.4.3', '']], 'type': 'int'}, |
| 281 |
'secondary_dns_ip4': {'v_range': [['7.4.3', '']], 'type': 'str'}, |
| 282 |
'secondary_dns_ip6_1': {'v_range': [['7.4.3', '']], 'type': 'int'}, |
| 283 |
'secondary_dns_ip6_2': {'v_range': [['7.4.3', '']], 'type': 'int'}, |
| 284 |
'secondary_dns_ip6_3': {'v_range': [['7.4.3', '']], 'type': 'int'}, |
| 285 |
'secondary_dns_ip6_4': {'v_range': [['7.4.3', '']], 'type': 'int'} |
| 286 |
} |
| 287 |
} |
| 288 |
} |
| 289 |
|
| 290 |
module_option_spec = get_module_arg_spec('full crud') |
| 291 |
module_arg_spec.update(module_option_spec) |
| 292 |
check_galaxy_version(module_arg_spec) |
| 293 |
module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'dvmdb_adom'), |
| 294 |
supports_check_mode=True) |
| 295 |
if not module._socket_path: |
| 296 |
module.fail_json(msg='MUST RUN IN HTTPAPI MODE') |
| 297 |
connection = Connection(module._socket_path) |
| 298 |
fmgr = NAPIManager('full crud', module_arg_spec, urls_list, |
| 299 |
'name', 'data', module, connection) |
| 300 |
fmgr.process_crud() |
| 301 |
module.exit_json(meta=module.params) |
| 302 |
|
| 303 |
|
| 304 |
if __name__ == '__main__': |
| 305 |
main() |