From 6002a4875ee9ffde3687a84a60b528f06371c840 Mon Sep 17 00:00:00 2001 From: kubealex Date: Thu, 3 Oct 2024 16:15:36 +0200 Subject: [PATCH] adapt to aap 2.5 --- CHANGELOG.md | 3 +- README.md | 113 +-------- galaxy.yml | 2 +- plugins/README.md | 5 - plugins/modules/eda_activations.py | 267 -------------------- plugins/modules/eda_credentials.py | 196 -------------- plugins/modules/eda_decision_environment.py | 137 ---------- plugins/modules/eda_projects.py | 181 ------------- roles/role_eda_controller_setup | 2 +- 9 files changed, 16 insertions(+), 890 deletions(-) delete mode 100644 plugins/modules/eda_activations.py delete mode 100644 plugins/modules/eda_credentials.py delete mode 100644 plugins/modules/eda_decision_environment.py delete mode 100644 plugins/modules/eda_projects.py diff --git a/CHANGELOG.md b/CHANGELOG.md index ba08a48..0c16f1a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,5 @@ - v1.0.0 - First release - v1.0.4 - Added modules to configure EDA Controller - v1.0.5 - Added role to configure EDA Controller -- v1.0.7 - Move asyncio_mqtt to aiomqtt \ No newline at end of file +- v1.0.7 - Move asyncio_mqtt to aiomqtt +- v1.0.10 - Adapt to AAP 2.5 - remove unused modules diff --git a/README.md b/README.md index 024a785..f4e973a 100644 --- a/README.md +++ b/README.md @@ -22,18 +22,18 @@ The following roles are included in the collection - role: role_eda_controller_setup vars: - eda_controller_url: "https://your-eda-controller-api.com" - eda_controller_user: "your_eda_user" - eda_controller_password: "your_eda_password" - eda_projects: - name: "EDA Demo Project" - git_url: "https://github.com/kubealex/event-driven-automation" - description: "Demo project to show EDA in action" - eda_decision_env: - name: "kubealex-eda" - image_url: "quay.io/kubealex/eda-decision-env" - eda_activations: - name: "eda-alertmanager" - rulebook: "eda-rulebook-alertmanager.yml" - project_name: EDA Demo Project - decision_env: Automation Hub Default Decision Environment + eda_controller_url: "https://your-eda-controller-api.com" + eda_controller_user: "your_eda_user" + eda_controller_password: "your_eda_password" + eda_projects: - name: "EDA Demo Project" + git_url: "https://github.com/kubealex/event-driven-automation" + description: "Demo project to show EDA in action" + eda_decision_env: - name: "kubealex-eda" + image_url: "quay.io/kubealex/eda-decision-env" + eda_activations: - name: "eda-alertmanager" + rulebook: "eda-rulebook-alertmanager.yml" + project_name: EDA Demo Project + decision_env: Automation Hub Default Decision Environment ``` ## Plugins @@ -63,92 +63,3 @@ A sample rulebook using _kubealex.eda.mqtt_ plugin is shown below action: debug: ``` - -## Modules - -The following modules are included in the collection - -| Name | Description | -| ------------------------------------- | ------------------------------------------------- | -| kubealex.eda.eda_activations | Configure activations in EDA Controller | -| kubealex.eda.eda_credentials | Configure credentials in EDA Controller | -| kubealex.eda.eda_decision_environment | Configure decision_environments in EDA Controller | -| kubealex.eda.eda_projects | Configure projects in EDA Controller | - -### Usage - -A sample playbook to create items using the modules is shown below: - -```yaml ---- -- name: Example Playbook - hosts: localhost - tasks: - - name: Create EDA Activations - kubealex.eda.eda_activations: - controller_url: "https://example-controller.com" - controller_user: "admin" - controller_password: "admin123" - activations: - - name: Activation 1 - project_name: Project 1 - rulebook: Rulebook 1 - extra_vars: {} - restart_policy: always - enabled: true - decision_env: Decision Environment 1 - - name: Activation 2 - project_name: Project 2 - rulebook: Rulebook 2 - extra_vars: {} - restart_policy: always - enabled: true - decision_env: Decision Environment 2 - - - name: Create EDA Decision Environments - kubealex.eda.eda_decision_environment: - controller_url: "https://example-controller.com" - controller_user: "admin" - controller_password: "admin123" - decision_envs: - - name: Decision Environment 1 - image_url: "http://example.com/decision_env1" - - name: Decision Environment 2 - image_url: "http://example.com/decision_env2" - - - name: Create EDA Credentials - kubealex.eda.eda_credentials: - controller_url: "https://example-controller.com" - controller_user: "admin" - controller_password: "admin123" - credentials: - - name: Credential 1 - description: "Credential 1 description" - username: "user1" - secret: "secret1" - credential_type: "GitHub Personal Access Token" - - name: Credential 2 - description: "Credential 2 description" - username: "user2" - secret: "secret2" - credential_type: "GitLab Personal Access Token" - - - name: Create EDA Projects - kubealex.eda.eda_projects: - controller_url: "https://example-controller.com" - controller_user: "admin" - controller_password: "admin123" - projects: - - project_name: Project 1 - project_description: "Project 1 description" - project_git_url: "http://example.com/project1" - project_credential: "Credential 1" - - project_name: Project 2 - project_description: "Project 2 description" - project_git_url: "http://example.com/project2" - project_credential: "Credential 2" -``` - -``` - -``` diff --git a/galaxy.yml b/galaxy.yml index fe3c75c..5f90f8e 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -4,7 +4,7 @@ namespace: kubealex name: eda -version: 1.0.9 +version: 1.0.10 readme: README.md diff --git a/plugins/README.md b/plugins/README.md index 82525a0..5ab751b 100644 --- a/plugins/README.md +++ b/plugins/README.md @@ -6,9 +6,4 @@ In this directory, all plugins that are supported by this collection are added. └── plugins └── event_source └── mqtt.py - modules - └── eda_activations.py - └── eda_credentials.py - └── eda_decision_environment.py - └── eda_projects.py ``` diff --git a/plugins/modules/eda_activations.py b/plugins/modules/eda_activations.py deleted file mode 100644 index e069ca3..0000000 --- a/plugins/modules/eda_activations.py +++ /dev/null @@ -1,267 +0,0 @@ -#!/usr/bin/python -DOCUMENTATION = """ ---- -module: eda_activations -short_description: Create activations in EDA Controller for a given project and decision environment -options: - controller_url: - description: - - The URL of the EDA Controller. - type: str - required: true - controller_user: - description: - - The username for authenticating with the EDA Controller. - type: str - required: true - controller_password: - description: - - The password for authenticating with the EDA Controller. - type: str - required: true - activations: - description: - - The list of activations to create. - - Each activation requires the following parameters: - - name: The name of the activation. - - project_name: The name of the project associated with the activation. - - rulebook: The name of the rulebook associated with the activation. - - extra_vars: The extra variables for the activation. - - restart_policy: The restart policy for the activation. Default: 'always' - - enabled: Whether the activation should be enabled. Default: true - - decision_env: The name of the decision environment. - - controller_token: The name of the controller token - - At least one activation must be provided. - type: list - required: true - elements: dict - options: - name: - description: - - The name of the activation. - type: str - required: true - project_name: - description: - - The name of the project associated with the activation. - type: str - required: true - rulebook: - description: - - The name of the rulebook associated with the activation. - type: str - required: true - extra_vars: - description: - - The extra variables for the activation. - - Default: '' - type: str - default: '' - restart_policy: - description: - - The restart policy for the activation. - - Default: 'always' - type: str - default: 'always' - enabled: - description: - - Whether the activation should be enabled. - - Default: true - type: bool - default: true - decision_env: - description: - - The name of the decision environment. - type: str - required: true - controller_token: - description: - - The name of the Controller Token to use - type: str - required: true -""" - -from ansible.module_utils.basic import AnsibleModule -import requests - - -def get_project_id(controller_url, controller_user, controller_password, project_name): - url = f"{controller_url}/api/eda/v1/projects/?name={project_name.replace(' ', '+')}" - response = requests.get( - url, auth=(controller_user, controller_password), verify=False - ) - if response.status_code in (200, 201): - projects = response.json().get("results", []) - if projects: - return int(projects[0].get("id")) - return None - - -def get_denv_id(controller_url, controller_user, controller_password, decision_env): - url = f"{controller_url}/api/eda/v1/decision-environments/?name={decision_env.replace(' ', '+')}" - response = requests.get( - url, auth=(controller_user, controller_password), verify=False - ) - if response.status_code in (200, 201): - denvs = response.json().get("results", []) - if denvs: - return int(denvs[0].get("id")) - return None - -def get_token_id(controller_url, controller_user, controller_password, controller_token): - url = f"{controller_url}/api/eda/v1/users/me/awx-tokens/" - response = requests.get( - url, auth=(controller_user, controller_password), verify=False - ) - if response.status_code in (200, 201): - awx_tokens = response.json().get("results", []) - if awx_tokens: - for token in awx_tokens: - if token.get("name") == controller_token: - return token.get("id") - return None - -def create_activations(module): - # Extract input parameters from the module object - controller_url = module.params["controller_url"] - controller_user = module.params["controller_user"] - controller_password = module.params["controller_password"] - activations = module.params["activations"] - - response_list = [] - - for activation in activations: - project_name = activation.get("project_name") - decision_env = activation.get("decision_env") - controller_token = activation.get("controller_token") - enabled = activation.get("enabled", True) - restart_policy = activation.get("restart_policy", "always") - activation_name = activation["name"] - rulebook_name = activation["rulebook"] - - if not project_name: - module.fail_json(msg="Project name is required for each activation.") - if not decision_env: - module.fail_json( - msg="Decision environment is required for each activation." - ) - if not controller_token: - module.fail_json(msg="Controller token name is required for each activation.") - - project_id = get_project_id( - controller_url, controller_user, controller_password, project_name - ) - if project_id is None: - module.fail_json(msg=f"Project '{project_name}' not found.") - - denv_id = get_denv_id( - controller_url, controller_user, controller_password, decision_env - ) - if denv_id is None: - module.fail_json(msg=f"Decision environment '{decision_env}' not found.") - - awx_token_id = get_token_id(controller_url, controller_user, controller_password, controller_token) - if not awx_token_id: - module.fail_json(msg=f"Controller token '{controller_token}' not found for user: '{controller_user}'") - - rulebook_list = [] - - # Retrieve rulebooks - rulebook_url = f"{controller_url}/api/eda/v1/rulebooks/?project_id={project_id}" - response = requests.get( - rulebook_url, auth=(controller_user, controller_password), verify=False - ) - if response.status_code in (200, 201): - rulebooks = response.json().get("results", []) - for rulebook in rulebooks: - if rulebook["name"] == rulebook_name: - rulebook_list.append(int(rulebook["id"])) - break - - if not rulebook_list: - module.fail_json( - msg=f"Rulebook '{rulebook_name}' not found in project '{project_name}'." - ) - - # Create activations for given project - activations_url = f"{controller_url}/api/eda/v1/activations/" - headers = {"Content-Type": "application/json"} - for rulebook_id in rulebook_list: - body = { - "name": activation_name, - "project_id": project_id, - "decision_environment_id": denv_id, - "rulebook_id": rulebook_id, - "restart_policy": restart_policy, - "is_enabled": enabled, - "awx_token_id": awx_token_id - } - if "extra_vars" in activation and activation["extra_vars"]: - vars_url = f"{controller_url}/api/eda/v1/extra-vars/" - extra_vars_body = {"extra_var": activation["extra_vars"]} - response = requests.post( - vars_url, - auth=(controller_user, controller_password), - json=extra_vars_body, - headers=headers, - verify=False, - timeout=15, - ) - if response.status_code in (200, 201): - body["extra_var_id"] = response.json().get("id") - - response = requests.post( - activations_url, - auth=(controller_user, controller_password), - json=body, - headers=headers, - verify=False, - timeout=15, - ) - if response.status_code in (200, 201): - response_list.append(response.json()) - elif response.status_code == 400 and "already exists" in ' '.join(response.json().get("name")): - response_list.append(response.json()) - else: - module.fail_json( - msg=f"Failed to create activation '{activation_name}' for project '{project_name}'. RESPONSE: {response.json()}" - ) - - module.exit_json(changed=True, activations=response_list) - - -def main(): - module_args = dict( - controller_url=dict(type='str', required=True), - controller_user=dict(type='str', required=True), - controller_password=dict(type='str', required=True, no_log=True), - activations=dict( - type='list', - required=True, - elements='dict', - options=dict( - name=dict(type='str', required=True), - project_name=dict(type='str', required=True), - rulebook=dict(type='str', required=True), - extra_vars=dict(type='str', default=''), - restart_policy=dict(type='str', default='always'), - enabled=dict(type='bool', default=True), - decision_env=dict(type='str', required=True), - controller_token=dict(type='str', required=True), - ), - ), - ) - - module = AnsibleModule( - argument_spec=module_args, - supports_check_mode=False - ) - - try: - create_activations(module) - except Exception as e: - module.fail_json(msg=str(e)) - - -if __name__ == '__main__': - main() diff --git a/plugins/modules/eda_credentials.py b/plugins/modules/eda_credentials.py deleted file mode 100644 index 3d02460..0000000 --- a/plugins/modules/eda_credentials.py +++ /dev/null @@ -1,196 +0,0 @@ -#!/usr/bin/python -DOCUMENTATION = """ ---- -module: eda_credentials -short_description: Create or update credentials in EDA Controller. -description: - - This module allows creating or updating credentials in EDA Controller. It supports various credential types - such as GitHub Personal Access Token, GitLab Personal Access Token, and Container registry. - The module uses the EDA Controller API to interact with the credentials. - -options: - controller_url: - description: - - The URL of the EDA Controller. - type: str - required: true - - controller_user: - description: - - The username for authentication with the EDA Controller. - type: str - required: true - - controller_password: - description: - - The password for authentication with the EDA Controller. - type: str - required: true - no_log: true - - credentials: - description: - - A list of credentials to create or update. - type: list - required: true - elements: dict - suboptions: - name: - description: - - The name of the credential. - type: str - required: true - - description: - description: - - The description of the credential. - type: str - required: false - - username: - description: - - The username associated with the credential. - type: str - required: true - - secret: - description: - - The secret/password associated with the credential. - type: str - required: true - no_log: true - - credential_type: - description: - - The type of the credential. - type: str - required: true - choices: - - "GitHub Personal Access Token" - - "GitLab Personal Access Token" - - "Container registry" - -notes: - - The module retrieves the list of existing credentials by making API requests to the EDA Controller. - - If a credential with the specified name already exists, it will be updated with the provided information. - Otherwise, a new credential will be created. - - The module uses basic authentication to authenticate with the EDA Controller. - -requirements: - - The requests module must be installed on the Ansible control node. - -""" -from ansible.module_utils.basic import AnsibleModule -import requests - - -def check_credential_exists(controller_url, controller_user, controller_password, name): - url = f"{controller_url}/api/eda/v1/credentials/?name={name}" - response = requests.get( - url, auth=(controller_user, controller_password), verify=False - ) - if response.status_code in (200, 201): - count = response.json().get("count", 0) - if count > 0: - credential_id = response.json().get("results", [{}])[0].get("id") - return int(credential_id) if credential_id else None - return None - - -def create_or_update_credentials(module): - # Extract input parameters from the module object - controller_url = module.params["controller_url"] - controller_user = module.params["controller_user"] - controller_password = module.params["controller_password"] - credentials = module.params["credentials"] - - response_list = [] - - for credential in credentials: - name = credential["name"] - description = credential.get("description") - username = credential["username"] - secret = credential["secret"] - credential_type = credential["credential_type"] - - # Check if credential exists - credential_id = check_credential_exists( - controller_url, controller_user, controller_password, name - ) - - # Prepare request body - body = { - "name": name, - "credential_type": credential_type, - "username": username, - "secret": secret, - } - if description: - body["description"] = description - - # Create or update credential - url = f"{controller_url}/api/eda/v1/credentials/" - if credential_id: - url += f"{credential_id}/" - response = requests.patch( - url, - auth=(controller_user, controller_password), - json=body, - verify=False, - ) - else: - response = requests.post( - url, - auth=(controller_user, controller_password), - json=body, - verify=False, - ) - - if response.status_code in (200, 201): - response_list.append(response.json()) - else: - module.fail_json(msg=f"Failed to create or update credential: {name}") - - # Debug message to display response content - module.debug(f"Response Content: {response.content}") - - module.exit_json(changed=True, credentials=response_list) - - -def main(): - module_args = dict( - controller_url=dict(type="str", required=True), - controller_user=dict(type="str", required=True), - controller_password=dict(type="str", required=True, no_log=True), - credentials=dict( - type="list", - required=True, - elements="dict", - options=dict( - description=dict(type="str", required=False), - name=dict(type="str", required=True), - username=dict(type="str", required=True), - secret=dict(type="str", required=True, no_log=True), - credential_type=dict( - type="str", - required=True, - choices=[ - "GitHub Personal Access Token", - "GitLab Personal Access Token", - "Container Registry", - ], - ), - ), - ), - ) - - module = AnsibleModule(argument_spec=module_args, supports_check_mode=False) - - try: - create_or_update_credentials(module) - except Exception as e: - module.fail_json(msg=str(e)) - - -if __name__ == "__main__": - main() diff --git a/plugins/modules/eda_decision_environment.py b/plugins/modules/eda_decision_environment.py deleted file mode 100644 index 932c27e..0000000 --- a/plugins/modules/eda_decision_environment.py +++ /dev/null @@ -1,137 +0,0 @@ -#!/usr/bin/python -DOCUMENTATION = """ ---- -module: eda_decision_envs -short_description: Create or update EDA decision environments. -description: - - This module allows you to create or update EDA (Event-Driven Architecture) decision environments in a controller. -version_added: "2.12" -options: - controller_url: - description: - - The URL of the EDA controller where the decision environments will be created or updated. - type: str - required: true - controller_user: - description: - - The username for authenticating with the EDA controller. - type: str - required: true - controller_password: - description: - - The password for authenticating with the EDA controller. - type: str - required: true - no_log: true - decision_envs: - description: - - A list of decision environments to create or update in the EDA controller. - type: list - required: true - elements: dict - options: - name: - description: - - The name of the decision environment. - type: str - required: true - image_url: - description: - - The image URL of the decision environment. - type: str - required: false -notes: - - To create or update EDA decision environments, provide the necessary information through the 'decision_envs' list argument. Each decision environment should be a dictionary with the following subarguments: - - 'name' (mandatory): The name of the decision environment. - - 'image_url' (optional): The image URL of the decision environment. - - The module will check if a decision environment already exists based on the 'name' provided. If the decision environment exists, it will be updated; otherwise, a new decision environment will be created. - - The 'image_url' field is optional and can be used to specify the image URL associated with the decision environment. -requirements: - - The 'requests' Python module must be installed on the Ansible control node. - -""" - -from ansible.module_utils.basic import AnsibleModule -import requests - - -def get_decision_environment_id( - controller_url, controller_user, controller_password, decision_environment_name -): - url = f"{controller_url}/api/eda/v1/decision-environments/?name={decision_environment_name.replace(' ', '+')}" - response = requests.get( - url, auth=(controller_user, controller_password), verify=False - ) - if response.status_code in (200, 201): - count = response.json().get("count", 0) - if count > 0: - denv_id = response.json().get("results", [{}])[0].get("id") - return int(denv_id) if denv_id else None - return None - - -def create_decision_environments(module): - # Extract input parameters from the module object - controller_url = module.params["controller_url"] - controller_user = module.params["controller_user"] - controller_password = module.params["controller_password"] - decision_envs = module.params["decision_envs"] - - response_list = [] - - for decision_env in decision_envs: - name = decision_env["name"] - image_url = decision_env.get("image_url", "") - - # Check if the decision environment already exists - denv_id = get_decision_environment_id( - controller_url, controller_user, controller_password, name - ) - - # Prepare request body - body = {"name": name, "image_url": image_url} - - # Create or update the decision environment - url = f"{controller_url}/api/eda/v1/decision-environments/" - if denv_id: - url += f"{denv_id}/" - - response = requests.request( - method="PATCH" if denv_id else "POST", - url=url, - auth=(controller_user, controller_password), - json=body, - verify=False, - ) - - if response.status_code in (200, 201): - response_list.append(response.json()) - else: - module.fail_json( - msg=f"Failed to create or update decision environment '{name}': {response.text}" - ) - - # Debug message to display response content - module.debug(f"Response Content: {response.content}") - - module.exit_json(changed=True, decision_environments=response_list) - - -def main(): - module_args = dict( - controller_url=dict(type="str", required=True), - controller_user=dict(type="str", required=True), - controller_password=dict(type="str", required=True, no_log=True), - decision_envs=dict(type="list", required=True), - ) - - module = AnsibleModule(argument_spec=module_args, supports_check_mode=False) - - try: - create_decision_environments(module) - except Exception as e: - module.fail_json(msg=str(e)) - - -if __name__ == "__main__": - main() diff --git a/plugins/modules/eda_projects.py b/plugins/modules/eda_projects.py deleted file mode 100644 index 1ed330b..0000000 --- a/plugins/modules/eda_projects.py +++ /dev/null @@ -1,181 +0,0 @@ -#!/usr/bin/python -DOCUMENTATION = """ ---- -module: eda_projects -short_description: Create or update EDA projects. -description: - - This module allows you to create or update EDA (Event-Driven Architecture) projects in a controller. -version_added: "2.12" -options: - controller_url: - description: - - The URL of the EDA controller where the projects will be created or updated. - type: str - required: true - controller_user: - description: - - The username for authenticating with the EDA controller. - type: str - required: true - controller_password: - description: - - The password for authenticating with the EDA controller. - type: str - required: true - no_log: true - projects: - description: - - A list of projects to create or update in the EDA controller. - type: list - required: true - elements: dict - options: - name: - description: - - The name of the project. - type: str - required: true - description: - description: - - The description of the project (optional). - type: str - required: false - git_url: - description: - - The Git URL of the project. - type: str - required: true - credential: - description: - - The name of the credential to associate with the project (optional). - type: str - required: false -notes: - - To create or update EDA projects, provide the necessary information through the 'projects' list argument. Each project should be a dictionary with the following subarguments: - - 'name' (mandatory): The name of the project. - - 'description' (optional): The description of the project. - - 'git_url' (mandatory): The Git URL of the project. - - 'credential' (optional): The name of the credential to associate with the project. - - The 'description' field is optional and will not be included in the payload if it is not defined. - - The module will check if a project already exists based on the 'name' provided. If the project exists, it will be updated; otherwise, a new project will be created. - - The 'credential' field is optional and allows associating a credential with the project for authentication purposes. -requirements: - - The 'requests' Python module must be installed on the Ansible control node. - -""" - -from ansible.module_utils.basic import AnsibleModule -import requests - - -def get_project_credential_id( - controller_url, controller_user, controller_password, project_credential -): - if not project_credential: - return None - - url = f"{controller_url}/api/eda/v1/credentials/?name={project_credential}" - response = requests.get( - url, auth=(controller_user, controller_password), verify=False - ) - if response.status_code in (200, 201): - credential_id = response.json().get("results", [{}])[0].get("id") - return int(credential_id) if credential_id else None - - -def create_project(module): - # Extract input parameters from the module object - controller_url = module.params["controller_url"] - controller_user = module.params["controller_user"] - controller_password = module.params["controller_password"] - projects = module.params["projects"] - - response_list = [] - - for project in projects: - project_name = project["name"] - project_description = project.get("description") - project_git_url = project["git_url"] - project_credential = project.get("credential") - - # Retrieve project_credential_id - project_credential_id = get_project_credential_id( - controller_url, controller_user, controller_password, project_credential - ) - - # Check if the project already exists - url = f"{controller_url}/api/eda/v1/projects/?name={project_name.replace(' ', '+')}" - response = requests.get( - url, auth=(controller_user, controller_password), verify=False - ) - if response.status_code in (200, 201): - project_exists = len(response.json().get("results", [])) > 0 - method = "PATCH" if project_exists else "POST" - project_id = ( - response.json().get("results", [{}])[0].get("id") - if project_exists - else None - ) - - # Create or update the project - url = f"{controller_url}/api/eda/v1/projects/{str(project_id) + '/' if project_id else ''}" - body = { - "name": project_name, - "url": project_git_url, - } - if project_description: - body["description"] = project_description - if project_credential_id: - body["credential_id"] = project_credential_id - - response = requests.request( - method, - url, - auth=(controller_user, controller_password), - json=body, - verify=False, - ) - - if response.status_code in (200, 201): - project_id = response.json().get("id") - response_list.append({"project_id": project_id}) - else: - module.fail_json( - msg=f"Failed to create/update project '{project_name}': {response.text}" - ) - else: - module.fail_json( - msg=f"Failed to check project '{project_name}': {response.text}" - ) - - module.exit_json(changed=True, projects=response_list) - - -def main(): - module_args = dict( - controller_url=dict(type="str", required=True), - controller_user=dict(type="str", required=True), - controller_password=dict(type="str", required=True, no_log=True), - projects=dict( - type="list", - required=True, - elements="dict", - options=dict( - name=dict(type="str", required=True), - description=dict(type="str", required=False), - git_url=dict(type="str", required=True), - credential=dict(type="str", required=False), - ), - ), - ) - - module = AnsibleModule(argument_spec=module_args, supports_check_mode=False) - - try: - create_project(module) - except Exception as e: - module.fail_json(msg=str(e)) - - -if __name__ == "__main__": - main() diff --git a/roles/role_eda_controller_setup b/roles/role_eda_controller_setup index 70de30a..ed8d74a 160000 --- a/roles/role_eda_controller_setup +++ b/roles/role_eda_controller_setup @@ -1 +1 @@ -Subproject commit 70de30ad3d7e0afc2c9d5b8851fa2e13bcbafffb +Subproject commit ed8d74abc44863404ccf4767235dcc75b4b03968