mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-08-29 23:08:06 +02:00
Added auto setting for redirect urls for keycloak clients. Element and Synapse still need to be mapped
This commit is contained in:
18
module_utils/get_url.py
Normal file
18
module_utils/get_url.py
Normal file
@@ -0,0 +1,18 @@
|
||||
from ansible.errors import AnsibleFilterError
|
||||
import sys, os
|
||||
|
||||
def get_url(domains, application_id, protocol):
|
||||
plugin_dir = os.path.dirname(__file__)
|
||||
project_root = os.path.dirname(plugin_dir)
|
||||
module_utils = os.path.join(project_root, 'module_utils')
|
||||
if module_utils not in sys.path:
|
||||
sys.path.append(module_utils)
|
||||
|
||||
try:
|
||||
from domain_utils import get_domain
|
||||
except ImportError as e:
|
||||
raise AnsibleFilterError(f"could not import domain_utils: {e}")
|
||||
|
||||
if not isinstance(protocol, str):
|
||||
raise AnsibleFilterError("Protocol must be a string")
|
||||
return f"{protocol}://{ get_domain(domains, application_id) }"
|
Reference in New Issue
Block a user