| 1 |
#!/usr/bin/python |
| 2 |
|
| 3 |
# Copyright (c) 2018, Johannes Brunswicker <[email protected]> |
| 4 |
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt) |
| 5 |
# SPDX-License-Identifier: GPL-3.0-or-later |
| 6 |
|
| 7 |
from __future__ import annotations |
| 8 |
|
| 9 |
DOCUMENTATION = r""" |
| 10 |
module: utm_proxy_location_info |
| 11 |
|
| 12 |
author: |
| 13 |
- Johannes Brunswicker (@MatrixCrawler) |
| 14 |
|
| 15 |
short_description: Create, update or destroy reverse_proxy location entry in Sophos UTM |
| 16 |
|
| 17 |
description: |
| 18 |
- Create, update or destroy a reverse_proxy location entry in SOPHOS UTM. |
| 19 |
- This module needs to have the REST Ability of the UTM to be activated. |
| 20 |
attributes: |
| 21 |
check_mode: |
| 22 |
version_added: 3.3.0 |
| 23 |
# This was backported to 2.5.4 and 1.3.11 as well, since this was a bugfix |
| 24 |
|
| 25 |
options: |
| 26 |
name: |
| 27 |
type: str |
| 28 |
description: |
| 29 |
- The name of the object that identifies the entry. |
| 30 |
required: true |
| 31 |
|
| 32 |
extends_documentation_fragment: |
| 33 |
- community.general._utm |
| 34 |
- community.general._attributes |
| 35 |
- community.general._attributes.info_module |
| 36 |
""" |
| 37 |
|
| 38 |
EXAMPLES = r""" |
| 39 |
- name: Remove UTM proxy_location |
| 40 |
community.general.utm_proxy_location_info: |
| 41 |
utm_host: sophos.host.name |
| 42 |
utm_token: abcdefghijklmno1234 |
| 43 |
name: TestLocationEntry |
| 44 |
""" |
| 45 |
|
| 46 |
RETURN = r""" |
| 47 |
result: |
| 48 |
description: The utm object that was created. |
| 49 |
returned: success |
| 50 |
type: complex |
| 51 |
contains: |
| 52 |
_ref: |
| 53 |
description: The reference name of the object. |
| 54 |
type: str |
| 55 |
_locked: |
| 56 |
description: Whether or not the object is currently locked. |
| 57 |
type: bool |
| 58 |
_type: |
| 59 |
description: The type of the object. |
| 60 |
type: str |
| 61 |
name: |
| 62 |
description: The name of the object. |
| 63 |
type: str |
| 64 |
access_control: |
| 65 |
description: Whether to use access control state. |
| 66 |
type: str |
| 67 |
allowed_networks: |
| 68 |
description: List of allowed network reference names. |
| 69 |
type: list |
| 70 |
auth_profile: |
| 71 |
description: The auth profile reference name. |
| 72 |
type: str |
| 73 |
backend: |
| 74 |
description: The backend reference name. |
| 75 |
type: str |
| 76 |
be_path: |
| 77 |
description: The backend path. |
| 78 |
type: str |
| 79 |
comment: |
| 80 |
description: The comment string. |
| 81 |
type: str |
| 82 |
denied_networks: |
| 83 |
description: The list of the denied network names. |
| 84 |
type: list |
| 85 |
hot_standby: |
| 86 |
description: Use hot standby. |
| 87 |
type: bool |
| 88 |
path: |
| 89 |
description: Path name. |
| 90 |
type: str |
| 91 |
status: |
| 92 |
description: Whether the object is active or not. |
| 93 |
type: bool |
| 94 |
stickysession_id: |
| 95 |
description: The identifier of the stickysession. |
| 96 |
type: str |
| 97 |
stickysession_status: |
| 98 |
description: Whether to use stickysession or not. |
| 99 |
type: bool |
| 100 |
websocket_passthrough: |
| 101 |
description: Whether websocket passthrough is used or not. |
| 102 |
type: bool |
| 103 |
""" |
| 104 |
|
| 105 |
from ansible_collections.community.general.plugins.module_utils._utm_utils import UTM, UTMModule |
| 106 |
|
| 107 |
|
| 108 |
def main(): |
| 109 |
endpoint = "reverse_proxy/location" |
| 110 |
key_to_check_for_changes = [] |
| 111 |
module = UTMModule( |
| 112 |
argument_spec=dict( |
| 113 |
name=dict(type="str", required=True), |
| 114 |
), |
| 115 |
supports_check_mode=True, |
| 116 |
) |
| 117 |
try: |
| 118 |
UTM(module, endpoint, key_to_check_for_changes, info_only=True).execute() |
| 119 |
except Exception as e: |
| 120 |
module.fail_json(msg=f"{e}") |
| 121 |
|
| 122 |
|
| 123 |
if __name__ == "__main__": |
| 124 |
main() |