| 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_fmg_sasemanager_status |
| 15 |
short_description: Fmg sase manager status |
| 16 |
version_added: "2.7.0" |
| 17 |
extends_documentation_fragment: |
| 18 |
- fortinet.fortimanager.general |
| 19 |
- fortinet.fortimanager.general.partial_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 |
fmg_sasemanager_status: |
| 29 |
description: The top level parameters set. |
| 30 |
required: false |
| 31 |
type: dict |
| 32 |
suboptions: |
| 33 |
forticlient_ver: |
| 34 |
aliases: ['forticlient-ver'] |
| 35 |
type: str |
| 36 |
description: Forticlient ver. |
| 37 |
forticloud_id: |
| 38 |
aliases: ['forticloud-id'] |
| 39 |
type: int |
| 40 |
description: Forticloud id. |
| 41 |
license_type: |
| 42 |
aliases: ['license-type'] |
| 43 |
type: str |
| 44 |
description: License type. |
| 45 |
choices: ['standard_license', 'advanced_license', 'comprehensive_license'] |
| 46 |
spa_hubs: |
| 47 |
aliases: ['spa-hubs'] |
| 48 |
type: int |
| 49 |
description: Spa hubs. |
| 50 |
''' |
| 51 |
|
| 52 |
EXAMPLES = ''' |
| 53 |
- name: Example playbook (generated based on argument schema) |
| 54 |
hosts: fortimanagers |
| 55 |
connection: httpapi |
| 56 |
gather_facts: false |
| 57 |
tasks: |
| 58 |
- name: Fmg sase manager status |
| 59 |
fortinet.fortimanager.fmgr_fmg_sasemanager_status: |
| 60 |
# workspace_locking_adom: <global or your adom name> |
| 61 |
adom: <your own value> |
| 62 |
fmg_sasemanager_status: |
| 63 |
# forticlient_ver: <string> |
| 64 |
# forticloud_id: <integer> |
| 65 |
# license_type: <value in [standard_license, advanced_license, comprehensive_license]> |
| 66 |
# spa_hubs: <integer> |
| 67 |
''' |
| 68 |
|
| 69 |
RETURN = ''' |
| 70 |
meta: |
| 71 |
description: The result of the request. |
| 72 |
type: dict |
| 73 |
returned: always |
| 74 |
contains: |
| 75 |
request_url: |
| 76 |
description: The full url requested. |
| 77 |
returned: always |
| 78 |
type: str |
| 79 |
sample: /sys/login/user |
| 80 |
response_code: |
| 81 |
description: The status of api request. |
| 82 |
returned: always |
| 83 |
type: int |
| 84 |
sample: 0 |
| 85 |
response_data: |
| 86 |
description: The api response. |
| 87 |
type: list |
| 88 |
returned: always |
| 89 |
response_message: |
| 90 |
description: The descriptive message of the api response. |
| 91 |
type: str |
| 92 |
returned: always |
| 93 |
sample: OK. |
| 94 |
system_information: |
| 95 |
description: The information of the target system. |
| 96 |
type: dict |
| 97 |
returned: always |
| 98 |
rc: |
| 99 |
description: The status the request. |
| 100 |
type: int |
| 101 |
returned: always |
| 102 |
sample: 0 |
| 103 |
version_check_warning: |
| 104 |
description: Warning if the parameters used in the playbook are not supported by the current FortiManager version. |
| 105 |
type: list |
| 106 |
returned: complex |
| 107 |
''' |
| 108 |
from ansible.module_utils.basic import AnsibleModule |
| 109 |
from ansible.module_utils.connection import Connection |
| 110 |
from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass |
| 111 |
from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec |
| 112 |
|
| 113 |
|
| 114 |
def main(): |
| 115 |
urls_list = [ |
| 116 |
'/pm/config/adom/{adom}/obj/fmg/sase-manager/status', |
| 117 |
'/pm/config/global/obj/fmg/sase-manager/status' |
| 118 |
] |
| 119 |
module_arg_spec = { |
| 120 |
'adom': {'required': True, 'type': 'str'}, |
| 121 |
'revision_note': {'type': 'str'}, |
| 122 |
'fmg_sasemanager_status': { |
| 123 |
'type': 'dict', 'v_range': [['7.6.0', '7.6.1']], |
| 124 |
'options': { |
| 125 |
'forticlient-ver': {'v_range': [['7.6.0', '7.6.1']], 'type': 'str'}, |
| 126 |
'forticloud-id': {'v_range': [['7.6.0', '7.6.1']], 'type': 'int'}, |
| 127 |
'license-type': { |
| 128 |
'v_range': [['7.6.0', '7.6.1']], |
| 129 |
'choices': ['standard_license', 'advanced_license', 'comprehensive_license'], |
| 130 |
'type': 'str' |
| 131 |
}, |
| 132 |
'spa-hubs': {'v_range': [['7.6.0', '7.6.1']], 'type': 'int'} |
| 133 |
} |
| 134 |
} |
| 135 |
} |
| 136 |
|
| 137 |
module_option_spec = get_module_arg_spec('partial crud') |
| 138 |
module_arg_spec.update(module_option_spec) |
| 139 |
check_galaxy_version(module_arg_spec) |
| 140 |
module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'fmg_sasemanager_status'), |
| 141 |
supports_check_mode=True) |
| 142 |
if not module._socket_path: |
| 143 |
module.fail_json(msg='MUST RUN IN HTTPAPI MODE') |
| 144 |
connection = Connection(module._socket_path) |
| 145 |
fmgr = NAPIManager('partial crud', module_arg_spec, urls_list, |
| 146 |
None, 'data', module, connection) |
| 147 |
fmgr.process_partial_crud() |
| 148 |
module.exit_json(meta=module.params) |
| 149 |
|
| 150 |
|
| 151 |
if __name__ == '__main__': |
| 152 |
main() |