| 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_fmupdate_fwmsetting_upgradetimeout |
| 15 |
short_description: Configure the timeout value of image upgrade process. |
| 16 |
version_added: "2.2.0" |
| 17 |
extends_documentation_fragment: |
| 18 |
- fortinet.fortimanager.general |
| 19 |
- fortinet.fortimanager.general.partial_crud |
| 20 |
options: |
| 21 |
fmupdate_fwmsetting_upgradetimeout: |
| 22 |
description: The top level parameters set. |
| 23 |
required: false |
| 24 |
type: dict |
| 25 |
suboptions: |
| 26 |
check_status_timeout: |
| 27 |
aliases: ['check-status-timeout'] |
| 28 |
type: int |
| 29 |
description: Timeout for checking status after tunnnel is up. |
| 30 |
ctrl_check_status_timeout: |
| 31 |
aliases: ['ctrl-check-status-timeout'] |
| 32 |
type: int |
| 33 |
description: Timeout for checking fap/fsw/fext status after request upgrade. |
| 34 |
ctrl_put_image_by_fds_timeout: |
| 35 |
aliases: ['ctrl-put-image-by-fds-timeout'] |
| 36 |
type: int |
| 37 |
description: Timeout for waiting device get fap/fsw/fext image from fortiguard. |
| 38 |
ha_sync_timeout: |
| 39 |
aliases: ['ha-sync-timeout'] |
| 40 |
type: int |
| 41 |
description: Timeout for waiting HA sync. |
| 42 |
license_check_timeout: |
| 43 |
aliases: ['license-check-timeout'] |
| 44 |
type: int |
| 45 |
description: Timeout for waiting fortigate check license. |
| 46 |
prepare_image_timeout: |
| 47 |
aliases: ['prepare-image-timeout'] |
| 48 |
type: int |
| 49 |
description: Timeout for preparing image. |
| 50 |
put_image_by_fds_timeout: |
| 51 |
aliases: ['put-image-by-fds-timeout'] |
| 52 |
type: int |
| 53 |
description: Timeout for waiting device get image from fortiguard. |
| 54 |
put_image_timeout: |
| 55 |
aliases: ['put-image-timeout'] |
| 56 |
type: int |
| 57 |
description: Timeout for waiting send image over tunnel. |
| 58 |
reboot_of_fsck_timeout: |
| 59 |
aliases: ['reboot-of-fsck-timeout'] |
| 60 |
type: int |
| 61 |
description: Timeout for waiting fortigate reboot. |
| 62 |
reboot_of_upgrade_timeout: |
| 63 |
aliases: ['reboot-of-upgrade-timeout'] |
| 64 |
type: int |
| 65 |
description: Timeout for waiting fortigate reboot after image upgrade. |
| 66 |
retrieve_timeout: |
| 67 |
aliases: ['retrieve-timeout'] |
| 68 |
type: int |
| 69 |
description: Timeout for waiting retrieve. |
| 70 |
rpc_timeout: |
| 71 |
aliases: ['rpc-timeout'] |
| 72 |
type: int |
| 73 |
description: Timeout for waiting fortigate rpc response. |
| 74 |
total_timeout: |
| 75 |
aliases: ['total-timeout'] |
| 76 |
type: int |
| 77 |
description: Timeout for the whole fortigate upgrade |
| 78 |
health_check_timeout: |
| 79 |
aliases: ['health-check-timeout'] |
| 80 |
type: int |
| 81 |
description: Timeout for waiting retrieve. |
| 82 |
''' |
| 83 |
|
| 84 |
EXAMPLES = ''' |
| 85 |
- name: Example playbook (generated based on argument schema) |
| 86 |
hosts: fortimanagers |
| 87 |
connection: httpapi |
| 88 |
gather_facts: false |
| 89 |
tasks: |
| 90 |
- name: Configure the timeout value of image upgrade process. |
| 91 |
fortinet.fortimanager.fmgr_fmupdate_fwmsetting_upgradetimeout: |
| 92 |
# workspace_locking_adom: <global or your adom name> |
| 93 |
fmupdate_fwmsetting_upgradetimeout: |
| 94 |
# check_status_timeout: <integer> |
| 95 |
# ctrl_check_status_timeout: <integer> |
| 96 |
# ctrl_put_image_by_fds_timeout: <integer> |
| 97 |
# ha_sync_timeout: <integer> |
| 98 |
# license_check_timeout: <integer> |
| 99 |
# prepare_image_timeout: <integer> |
| 100 |
# put_image_by_fds_timeout: <integer> |
| 101 |
# put_image_timeout: <integer> |
| 102 |
# reboot_of_fsck_timeout: <integer> |
| 103 |
# reboot_of_upgrade_timeout: <integer> |
| 104 |
# retrieve_timeout: <integer> |
| 105 |
# rpc_timeout: <integer> |
| 106 |
# total_timeout: <integer> |
| 107 |
# health_check_timeout: <integer> |
| 108 |
''' |
| 109 |
|
| 110 |
RETURN = ''' |
| 111 |
meta: |
| 112 |
description: The result of the request. |
| 113 |
type: dict |
| 114 |
returned: always |
| 115 |
contains: |
| 116 |
request_url: |
| 117 |
description: The full url requested. |
| 118 |
returned: always |
| 119 |
type: str |
| 120 |
sample: /sys/login/user |
| 121 |
response_code: |
| 122 |
description: The status of api request. |
| 123 |
returned: always |
| 124 |
type: int |
| 125 |
sample: 0 |
| 126 |
response_data: |
| 127 |
description: The api response. |
| 128 |
type: list |
| 129 |
returned: always |
| 130 |
response_message: |
| 131 |
description: The descriptive message of the api response. |
| 132 |
type: str |
| 133 |
returned: always |
| 134 |
sample: OK. |
| 135 |
system_information: |
| 136 |
description: The information of the target system. |
| 137 |
type: dict |
| 138 |
returned: always |
| 139 |
rc: |
| 140 |
description: The status the request. |
| 141 |
type: int |
| 142 |
returned: always |
| 143 |
sample: 0 |
| 144 |
version_check_warning: |
| 145 |
description: Warning if the parameters used in the playbook are not supported by the current FortiManager version. |
| 146 |
type: list |
| 147 |
returned: complex |
| 148 |
''' |
| 149 |
from ansible.module_utils.basic import AnsibleModule |
| 150 |
from ansible.module_utils.connection import Connection |
| 151 |
from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass |
| 152 |
from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec |
| 153 |
|
| 154 |
|
| 155 |
def main(): |
| 156 |
urls_list = [ |
| 157 |
'/cli/global/fmupdate/fwm-setting/upgrade-timeout' |
| 158 |
] |
| 159 |
module_arg_spec = { |
| 160 |
'fmupdate_fwmsetting_upgradetimeout': { |
| 161 |
'type': 'dict', 'v_range': [['7.0.5', '7.0.16'], ['7.2.2', '']], |
| 162 |
'options': { |
| 163 |
'check-status-timeout': {'v_range': [['7.0.5', '7.0.16'], ['7.2.2', '']], 'type': 'int'}, |
| 164 |
'ctrl-check-status-timeout': {'v_range': [['7.0.5', '7.0.16'], ['7.2.2', '']], 'type': 'int'}, |
| 165 |
'ctrl-put-image-by-fds-timeout': {'v_range': [['7.0.5', '7.0.16'], ['7.2.2', '']], 'type': 'int'}, |
| 166 |
'ha-sync-timeout': {'v_range': [['7.0.5', '7.0.16'], ['7.2.2', '']], 'type': 'int'}, |
| 167 |
'license-check-timeout': {'v_range': [['7.0.5', '7.0.16'], ['7.2.2', '']], 'type': 'int'}, |
| 168 |
'prepare-image-timeout': {'v_range': [['7.0.5', '7.0.16'], ['7.2.2', '']], 'type': 'int'}, |
| 169 |
'put-image-by-fds-timeout': {'v_range': [['7.0.5', '7.0.16'], ['7.2.2', '']], 'type': 'int'}, |
| 170 |
'put-image-timeout': {'v_range': [['7.0.5', '7.0.16'], ['7.2.2', '']], 'type': 'int'}, |
| 171 |
'reboot-of-fsck-timeout': {'v_range': [['7.0.5', '7.0.16'], ['7.2.2', '']], 'type': 'int'}, |
| 172 |
'reboot-of-upgrade-timeout': {'v_range': [['7.0.5', '7.0.16'], ['7.2.2', '']], 'type': 'int'}, |
| 173 |
'retrieve-timeout': {'v_range': [['7.0.5', '7.0.16'], ['7.2.2', '']], 'type': 'int'}, |
| 174 |
'rpc-timeout': {'v_range': [['7.0.5', '7.0.16'], ['7.2.2', '']], 'type': 'int'}, |
| 175 |
'total-timeout': {'v_range': [['7.0.5', '7.0.16'], ['7.2.2', '']], 'type': 'int'}, |
| 176 |
'health-check-timeout': {'v_range': [['7.4.2', '']], 'type': 'int'} |
| 177 |
} |
| 178 |
} |
| 179 |
} |
| 180 |
|
| 181 |
module_option_spec = get_module_arg_spec('partial crud') |
| 182 |
module_arg_spec.update(module_option_spec) |
| 183 |
check_galaxy_version(module_arg_spec) |
| 184 |
module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'fmupdate_fwmsetting_upgradetimeout'), |
| 185 |
supports_check_mode=True) |
| 186 |
if not module._socket_path: |
| 187 |
module.fail_json(msg='MUST RUN IN HTTPAPI MODE') |
| 188 |
connection = Connection(module._socket_path) |
| 189 |
fmgr = NAPIManager('partial crud', module_arg_spec, urls_list, |
| 190 |
None, 'data', module, connection) |
| 191 |
fmgr.process_partial_crud() |
| 192 |
module.exit_json(meta=module.params) |
| 193 |
|
| 194 |
|
| 195 |
if __name__ == '__main__': |
| 196 |
main() |