| 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_aaa_group_info |
| 11 |
|
| 12 |
author: |
| 13 |
- Johannes Brunswicker (@MatrixCrawler) |
| 14 |
|
| 15 |
short_description: Get info for reverse_proxy frontend entry in Sophos UTM |
| 16 |
|
| 17 |
description: |
| 18 |
- Get info for a reverse_proxy frontend entry in SOPHOS UTM. |
| 19 |
attributes: |
| 20 |
check_mode: |
| 21 |
version_added: 3.3.0 |
| 22 |
# This was backported to 2.5.4 and 1.3.11 as well, since this was a bugfix |
| 23 |
|
| 24 |
options: |
| 25 |
name: |
| 26 |
type: str |
| 27 |
description: |
| 28 |
- The name of the object that identifies the entry. |
| 29 |
required: true |
| 30 |
|
| 31 |
extends_documentation_fragment: |
| 32 |
- community.general._utm |
| 33 |
- community.general._attributes |
| 34 |
- community.general._attributes.info_module |
| 35 |
""" |
| 36 |
|
| 37 |
EXAMPLES = r""" |
| 38 |
- name: Remove UTM aaa_group |
| 39 |
community.general.utm_aaa_group_info: |
| 40 |
utm_host: sophos.host.name |
| 41 |
utm_token: abcdefghijklmno1234 |
| 42 |
name: TestAAAGroupEntry |
| 43 |
""" |
| 44 |
|
| 45 |
RETURN = r""" |
| 46 |
result: |
| 47 |
description: The utm object that was created. |
| 48 |
returned: success |
| 49 |
type: complex |
| 50 |
contains: |
| 51 |
_ref: |
| 52 |
description: The reference name of the object. |
| 53 |
type: str |
| 54 |
_locked: |
| 55 |
description: Whether or not the object is currently locked. |
| 56 |
type: bool |
| 57 |
_type: |
| 58 |
description: The type of the object. |
| 59 |
type: str |
| 60 |
name: |
| 61 |
description: The name of the object. |
| 62 |
type: str |
| 63 |
adirectory_groups: |
| 64 |
description: List of Active Directory Groups. |
| 65 |
type: str |
| 66 |
adirectory_groups_sids: |
| 67 |
description: List of Active Directory Groups SIDS. |
| 68 |
type: list |
| 69 |
backend_match: |
| 70 |
description: The backend to use. |
| 71 |
type: str |
| 72 |
comment: |
| 73 |
description: The comment string. |
| 74 |
type: str |
| 75 |
dynamic: |
| 76 |
description: Whether the group match is V(ipsec_dn) or V(directory_group). |
| 77 |
type: str |
| 78 |
edirectory_groups: |
| 79 |
description: List of eDirectory Groups. |
| 80 |
type: str |
| 81 |
ipsec_dn: |
| 82 |
description: Ipsec_dn identifier to match. |
| 83 |
type: str |
| 84 |
ldap_attribute: |
| 85 |
description: The LDAP Attribute to match against. |
| 86 |
type: str |
| 87 |
ldap_attribute_value: |
| 88 |
description: The LDAP Attribute Value to match against. |
| 89 |
type: str |
| 90 |
members: |
| 91 |
description: List of member identifiers of the group. |
| 92 |
type: list |
| 93 |
network: |
| 94 |
description: The identifier of the network (network/aaa). |
| 95 |
type: str |
| 96 |
radius_group: |
| 97 |
description: The radius group identifier. |
| 98 |
type: str |
| 99 |
tacacs_group: |
| 100 |
description: The tacacs group identifier. |
| 101 |
type: str |
| 102 |
""" |
| 103 |
|
| 104 |
from ansible_collections.community.general.plugins.module_utils._utm_utils import UTM, UTMModule |
| 105 |
|
| 106 |
|
| 107 |
def main(): |
| 108 |
endpoint = "aaa/group" |
| 109 |
key_to_check_for_changes = [] |
| 110 |
module = UTMModule( |
| 111 |
argument_spec=dict(name=dict(type="str", required=True)), |
| 112 |
supports_check_mode=True, |
| 113 |
) |
| 114 |
try: |
| 115 |
UTM(module, endpoint, key_to_check_for_changes, info_only=True).execute() |
| 116 |
except Exception as e: |
| 117 |
module.fail_json(msg=f"{e}") |
| 118 |
|
| 119 |
|
| 120 |
if __name__ == "__main__": |
| 121 |
main() |