Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use module_defaults
Browse files Browse the repository at this point in the history
Signed-off-by: Alina Buzachis <[email protected]>
alinabuzachis committed Aug 20, 2024
1 parent 317a9d8 commit 1b78080
Showing 24 changed files with 408 additions and 624 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/integration.yml
Original file line number Diff line number Diff line change
@@ -73,5 +73,5 @@ jobs:
working-directory: ansible_collections/ansible/eda

- name: Run integration tests
run: ansible-test integration project
run: ansible-test integration -v
working-directory: ansible_collections/ansible/eda
2 changes: 1 addition & 1 deletion plugins/module_utils/controller.py
Original file line number Diff line number Diff line change
@@ -91,7 +91,7 @@ def get_exactly_one(
self, endpoint, name=None, **kwargs
) -> Optional[dict[str, bool]]:
result = self.get_one_or_many(
endpoint, name=name, allow_none=False, want_one=True, **kwargs
endpoint, name=name, allow_none=True, want_one=True, **kwargs
)
# typing: needed as get_one_or_many can also return lists, not expected
# to reach this ever.
4 changes: 2 additions & 2 deletions plugins/modules/activation.py
Original file line number Diff line number Diff line change
@@ -303,7 +303,7 @@ def main() -> None:
argument_spec.update(AUTH_ARGSPEC)

required_if = [
("state", "present", ("name", "rulebook_name", "decision_environment_name"))
("state", "present", ("name", "rulebook_name", "decision_environment_name", "organization_name"))
]

module = AnsibleModule(
@@ -325,7 +325,7 @@ def main() -> None:

# Attempt to find rulebook activation based on the provided name
try:
activation = controller.get_exactly_one("activations", name=name)
activation = controller.get_one_or_many("activations", name=name)
except EDAError as e:
module.fail_json(msg=f"Failed to get rulebook activation: {e}")

9 changes: 2 additions & 7 deletions plugins/modules/project_info.py
Original file line number Diff line number Diff line change
@@ -80,6 +80,7 @@
# pylint: disable=relative-beyond-top-level
from ..module_utils.arguments import AUTH_ARGSPEC
from ..module_utils.client import Client
from ..module_utils.common import to_list_of_dict
from ..module_utils.controller import Controller
from ..module_utils.errors import EDAError

@@ -106,20 +107,14 @@ def main() -> None:

project_name = module.params.get("name")

ret: list[Any] = []

try:
result = controller.get_one_or_many(
project_endpoint, name=project_name, want_one=False
)
except EDAError as eda_err:
module.fail_json(msg=str(eda_err))

if result is None:
ret = []
if not isinstance(result, list):
ret = [result]
module.exit_json(projects=ret)
module.exit_json(projects=to_list_of_dict(result))


if __name__ == "__main__":
50 changes: 15 additions & 35 deletions tests/integration/targets/activation/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
---
- block:
- name: Set defaults for credentials
set_fact:
credential_defaults: &credential_defaults
controller_username: "{{ controller_username }}"
controller_password: "{{ controller_password }}"
controller_host: "{{ controller_host }}"
validate_certs: false
no_log: true

- name: Rulebook activation integration tests
module_defaults:
group/ansible.eda.eda:
controller_host: "{{ controller_host }}"
controller_username: "{{ controller_username }}"
controller_password: "{{ controller_password }}"
validate_certs: "{{ controller_verify_ssl }}"
block:
- name: Generate a random_string for the test
set_fact:
random_string: "{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}"
@@ -34,15 +32,13 @@

- name: Create an AWX controller token
ansible.eda.controller_token:
<<: *credential_defaults
name: "{{ awx_token_name }}"
description: "A test AWX controller token description"
token: "{{ token_value }}"
state: present

- name: Create a new credential type
ansible.eda.credential_type:
<<: *credential_defaults
name: "{{ credential_type_name }}"
state: present
description: "A test credential type"
@@ -90,7 +86,6 @@

- name: Create a new SCM credential
ansible.eda.credential:
<<: *credential_defaults
name: "{{ credential_name }}"
state: present
credential_type_name: Source Control
@@ -110,7 +105,6 @@

- name: Create a new project
ansible.eda.project:
<<: *credential_defaults
name: "{{ project_name }}"
description: "Test Project Description"
url: "{{ scm_url }}"
@@ -127,7 +121,6 @@

- name: Create a new decision environment
ansible.eda.decision_environment:
<<: *credential_defaults
name: "{{ decision_env_name }}"
description: "Test Decision Environment Description"
credential: "{{ credential_name }}"
@@ -137,7 +130,6 @@

- name: Create a new rulebook activation in check mode
ansible.eda.activation:
<<: *credential_defaults
name: "{{ activation_name }}"
description: "Example Activation description"
project_name: "{{ project_name }}"
@@ -156,7 +148,6 @@

- name: Create a new rulebook activation
ansible.eda.activation:
<<: *credential_defaults
name: "{{ activation_name }}"
description: "Example Activation description"
project_name: "{{ project_name }}"
@@ -174,7 +165,6 @@

- name: Create a new rulebook activation again
ansible.eda.activation:
<<: *credential_defaults
name: "{{ activation_name }}"
description: "Example Activation description"
project_name: "{{ project_name }}"
@@ -193,16 +183,13 @@

- name: Get information about the rulebook activation
ansible.eda.activation_info:
<<: *credential_defaults
name: "{{ activation_name }}"

- name: List all the rulebook activations
ansible.eda.activation_info:
<<: *credential_defaults

- name: Delete project
ansible.eda.project:
<<: *credential_defaults
name: "{{ project_name }}"
state: absent
register: project_deletion
@@ -215,7 +202,6 @@

- name: Delete credential
ansible.eda.credential:
<<: *credential_defaults
name: "{{ credential_name }}"
state: absent
register: credential_deletion
@@ -228,49 +214,43 @@

- name: Delete rulebook activation
ansible.eda.activation:
<<: *credential_defaults
name: "{{ activation_name }}"
state: absent

always:
- name: Delete AWX token
ansible.eda.controller_token:
<<: *credential_defaults
name: "{{ awx_token_name }}"
state: absent
ignore_errors: true

- name: Delete project
ansible.eda.project:
<<: *credential_defaults
name: "{{ project_name }}"
state: absent
ignore_errors: true

- name: Delete decision environment
ansible.eda.decision_environment:
<<: *credential_defaults
name: "{{ decision_env_name }}"
state: absent
ignore_errors: true

- name: Delete credential
ansible.eda.credential:
<<: *credential_defaults
name: "{{ credential_name }}"
state: absent
ignore_errors: true

- name: Delete credential type
ansible.eda.credential_type:
<<: *credential_defaults
name: "{{ credential_type_name }}"
state: absent
ignore_errors: true

- name: Delete rulebook activation
ansible.eda.activation:
<<: *credential_defaults
name: "{{ activation_name }}"
state: absent
ignore_errors: true

- name: Delete decision environment
ansible.eda.decision_environment:
name: "{{ decision_env_name }}"
state: absent
ignore_errors: true

12 changes: 0 additions & 12 deletions tests/integration/targets/controller_token/tasks/create.yml
Original file line number Diff line number Diff line change
@@ -4,10 +4,6 @@

- name: Create controller token in check mode
ansible.eda.controller_token:
controller_host: "{{ controller_host }}"
controller_username: "{{ controller_username }}"
controller_password: "{{ controller_password }}"
validate_certs: "{{ controller_verify_ssl }}"
name: "{{ controller_token_name }}"
description: "Example controller token description"
token: "TOKEN_VALUE"
@@ -23,10 +19,6 @@

- name: Create controller token
ansible.eda.controller_token:
controller_host: "{{ controller_host }}"
controller_username: "{{ controller_username }}"
controller_password: "{{ controller_password }}"
validate_certs: "{{ controller_verify_ssl }}"
name: "{{ controller_token_name }}"
description: "Example controller token description"
token: "TOKEN_VALUE"
@@ -42,10 +34,6 @@

- name: Create controller token again
ansible.eda.controller_token:
controller_host: "{{ controller_host }}"
controller_username: "{{ controller_username }}"
controller_password: "{{ controller_password }}"
validate_certs: "{{ controller_verify_ssl }}"
name: "{{ controller_token_name }}"
description: "Example controller token description"
token: "TOKEN_VALUE"
14 changes: 9 additions & 5 deletions tests/integration/targets/controller_token/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -2,7 +2,15 @@
# Copyright: Contributors to the Ansible project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)

- block:
- name: Controller token integration tests
module_defaults:
group/ansible.eda.eda:
controller_host: "{{ controller_host }}"
controller_username: "{{ controller_username }}"
controller_password: "{{ controller_password }}"
validate_certs: "{{ controller_verify_ssl }}"

block:
- name: Generate a random_string for the test
set_fact:
random_string: "{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}"
@@ -21,10 +29,6 @@
always:
- name: Clean up - controller token
ansible.eda.controller_token:
controller_host: "{{ controller_host }}"
controller_username: "{{ controller_username }}"
controller_password: "{{ controller_password }}"
validate_certs: "{{ controller_verify_ssl }}"
name: "{{ item }}"
state: absent
loop:
354 changes: 169 additions & 185 deletions tests/integration/targets/credential/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,193 +1,178 @@
---
- block:
- set_fact:
credential_defaults: &credential_defaults
controller_username: "{{ controller_username }}"
controller_password: "{{ controller_password }}"
controller_host: "{{ controller_host }}"
validate_certs: false
no_log: true

- name: Generate a random_string for the test
set_fact:
random_string: "{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}"
when: random_string is not defined

- name: Generate a ID for the test
set_fact:
test_id: "{{ random_string | to_uuid }}"
when: test_id is not defined

- name: Define variables for credential and project
set_fact:
credential_name: "Test_Credential_{{ test_id }}"
new_credential_name: "New_Test_Credential_{{ test_id }}"
credential_type_name: "Test_CredentialType_{{ test_id }}"

# CREATE
- name: Create credential type
ansible.eda.credential_type:
<<: *credential_defaults
name: "{{ credential_type_name }}"
state: present
description: "A test credential type"
inputs:
fields:
- id: "field1"
type: "string"
label: "Field 5"
injectors:
extra_vars:
field1: "field1"

- name: Create credential in check mode
ansible.eda.credential:
<<: *credential_defaults
state: present
name: "{{ credential_name }}"
description: "This is a test credential"
credential_type_name: "{{ credential_type_name }}"
inputs:
field1: "field1"
organization_name: Default
check_mode: true
register: _result

- name: Check credential creation in check mode
assert:
that:
- _result.changed

- name: Create credential
ansible.eda.credential:
<<: *credential_defaults
state: present
name: "{{ credential_name }}"
description: "This is a test credential"
credential_type_name: "{{ credential_type_name }}"
inputs:
field1: "field1"
organization_name: Default
register: _result

- name: Check credential creation
assert:
that:
- _result.changed

- name: Create credential again
ansible.eda.credential:
<<: *credential_defaults
state: present
name: "{{ credential_name }}"
description: "This is a test credential"
credential_type_name: "{{ credential_type_name }}"
inputs:
field1: "field1"
organization_name: Default
register: _result

# [WARNING]: The field inputs of unknown 3 has encrypted data and may inaccurately report task is changed.
- name: Check credential is not created again
assert:
that:
- not _result.changed
ignore_errors: true

- name: Get info about a credential
ansible.eda.credential_info:
<<: *credential_defaults
name: "{{ credential_name }}"

# UPDATE
- name: Update credential name
ansible.eda.credential:
<<: *credential_defaults
state: present
name: "{{ new_credential_name }}"
description: "This is a test credential"
credential_type_name: "{{ credential_type_name }}"
inputs:
field1: "field1"
organization_name: Default
register: _result

- name: Check credential update
assert:
that:
- _result.changed

- name: Update credential again
ansible.eda.credential:
<<: *credential_defaults
state: present
name: "{{ new_credential_name }}"
description: "This is a test credential"
credential_type_name: "{{ credential_type_name }}"
inputs:
- name: Credential integration tests
module_defaults:
group/ansible.eda.eda:
controller_host: "{{ controller_host }}"
controller_username: "{{ controller_username }}"
controller_password: "{{ controller_password }}"
validate_certs: "{{ controller_verify_ssl }}"
block:
- name: Generate a random_string for the test
set_fact:
random_string: "{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}"
when: random_string is not defined

- name: Generate a ID for the test
set_fact:
test_id: "{{ random_string | to_uuid }}"
when: test_id is not defined

- name: Define variables for credential and project
set_fact:
credential_name: "Test_Credential_{{ test_id }}"
new_credential_name: "New_Test_Credential_{{ test_id }}"
credential_type_name: "Test_CredentialType_{{ test_id }}"

# CREATE
- name: Create credential type
ansible.eda.credential_type:
name: "{{ credential_type_name }}"
state: present
description: "A test credential type"
inputs:
fields:
- id: "field1"
type: "string"
label: "Field 5"
injectors:
extra_vars:
field1: "field1"
organization_name: Default
register: _result

# [WARNING]: The field inputs of unknown 3 has encrypted data and may inaccurately report task is changed.
- name: Check credential is not updated again
assert:
that:
- not _result.changed
ignore_errors: true

- name: Get info about credential
ansible.eda.credential_info:
<<: *credential_defaults
name: "{{ new_credential_name }}"

- name: List all credentials
ansible.eda.credential_info:
<<: *credential_defaults

# DELETE
- name: Delete operation type without required name parameter
ansible.eda.credential:
<<: *credential_defaults
state: absent
ignore_errors: true
register: _result

- name: Check if credential name is required
assert:
that:
- _result.failed
- "'missing required arguments: name' in _result.msg"

- name: Delete non-existing credential in check mode
ansible.eda.credential:
<<: *credential_defaults
name: "Example2"
state: absent
check_mode: true
register: _result

- name: Check if delete non-existing credential in check mode
assert:
that:
- not _result.changed

- name: Delete credential
ansible.eda.credential:
<<: *credential_defaults
name: "{{ new_credential_name }}"
state: absent
register: _result

- name: Check if delete non-existing credential
assert:
that:
- _result.changed

- name: Create credential in check mode
ansible.eda.credential:
state: present
name: "{{ credential_name }}"
description: "This is a test credential"
credential_type_name: "{{ credential_type_name }}"
inputs:
field1: "field1"
organization_name: Default
check_mode: true
register: _result

- name: Check credential creation in check mode
assert:
that:
- _result.changed

- name: Create credential
ansible.eda.credential:
state: present
name: "{{ credential_name }}"
description: "This is a test credential"
credential_type_name: "{{ credential_type_name }}"
inputs:
field1: "field1"
organization_name: Default
register: _result

- name: Check credential creation
assert:
that:
- _result.changed

- name: Create credential again
ansible.eda.credential:
state: present
name: "{{ credential_name }}"
description: "This is a test credential"
credential_type_name: "{{ credential_type_name }}"
inputs:
field1: "field1"
organization_name: Default
register: _result

# [WARNING]: The field inputs of unknown 3 has encrypted data and may inaccurately report task is changed.
- name: Check credential is not created again
assert:
that:
- not _result.changed
ignore_errors: true

- name: Get info about a credential
ansible.eda.credential_info:
name: "{{ credential_name }}"

# UPDATE
- name: Update credential name
ansible.eda.credential:
state: present
name: "{{ new_credential_name }}"
description: "This is a test credential"
credential_type_name: "{{ credential_type_name }}"
inputs:
field1: "field1"
organization_name: Default
register: _result

- name: Check credential update
assert:
that:
- _result.changed

- name: Update credential again
ansible.eda.credential:
state: present
name: "{{ new_credential_name }}"
description: "This is a test credential"
credential_type_name: "{{ credential_type_name }}"
inputs:
field1: "field1"
organization_name: Default
register: _result

# [WARNING]: The field inputs of unknown 3 has encrypted data and may inaccurately report task is changed.
- name: Check credential is not updated again
assert:
that:
- not _result.changed
ignore_errors: true

- name: Get info about credential
ansible.eda.credential_info:
name: "{{ new_credential_name }}"

- name: List all credentials
ansible.eda.credential_info:

# DELETE
- name: Delete operation type without required name parameter
ansible.eda.credential:
state: absent
ignore_errors: true
register: _result

- name: Check if credential name is required
assert:
that:
- _result.failed
- "'missing required arguments: name' in _result.msg"

- name: Delete non-existing credential in check mode
ansible.eda.credential:
name: "Example2"
state: absent
check_mode: true
register: _result

- name: Check if delete non-existing credential in check mode
assert:
that:
- not _result.changed

- name: Delete credential
ansible.eda.credential:
name: "{{ new_credential_name }}"
state: absent
register: _result

- name: Check if delete non-existing credential
assert:
that:
- _result.changed
always:
- name: Clean up - credential
ansible.eda.credential:
<<: *credential_defaults
name: "{{ item }}"
state: absent
loop:
@@ -197,7 +182,6 @@

- name: Clean up - credential type
ansible.eda.credential_type:
<<: *credential_defaults
name: "{{ credential_type_name }}"
state: absent
ignore_errors: true
345 changes: 167 additions & 178 deletions tests/integration/targets/credential_type/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,186 +1,175 @@
---
- block:
- set_fact:
credential_defaults: &credential_defaults
controller_username: "{{ controller_username }}"
controller_password: "{{ controller_password }}"
controller_host: "{{ controller_host }}"
validate_certs: false
no_log: true

- name: Generate a random_string for the test
set_fact:
random_string: "{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}"
when: random_string is not defined

- name: Generate a ID for the test
set_fact:
test_id: "{{ random_string | to_uuid }}"
when: test_id is not defined

- name: Define variables for credential and project
set_fact:
credential_type_name: "Test_CredentialType_{{ test_id }}"
new_credential_type_name: "New_Test_CredentialType_{{ test_id }}"

# CREATE
- name: Create credential type in check mode
ansible.eda.credential_type:
<<: *credential_defaults
name: "{{ credential_type_name }}"
state: present
description: "A test credential type"
inputs:
fields:
- id: "field1"
type: "string"
label: "Field 5"
injectors:
extra_vars:
field1: "field1"
check_mode: true
register: _result

- name: Check credential type creation in check mode
assert:
that:
- _result.changed

- name: Create credential type
ansible.eda.credential_type:
<<: *credential_defaults
name: "{{ credential_type_name }}"
state: present
description: "A test credential type"
inputs:
fields:
- id: "field1"
type: "string"
label: "Field 5"
injectors:
extra_vars:
field1: "field1"
register: _result

- name: Check credential type creation
assert:
that:
- _result.changed

- name: Create credential type again
ansible.eda.credential_type:
<<: *credential_defaults
name: "{{ credential_type_name }}"
state: present
description: "A test credential type"
inputs:
fields:
- id: "field1"
type: "string"
label: "Field 5"
injectors:
extra_vars:
field1: "field1"
register: _result

- name: Check credential type is not created again
assert:
that:
- not _result.changed

- name: Get info about a credential type
ansible.eda.credential_type_info:
<<: *credential_defaults
name: "{{ credential_type_name }}"

# UPDATE
- name: Update credential type name
ansible.eda.credential_type:
<<: *credential_defaults
name: "{{ credential_type_name }}"
new_name: "{{ new_credential_type_name }}"
state: present
description: "A test credential type"
inputs:
fields:
- id: "field1"
type: "string"
label: "Field 5"
injectors:
extra_vars:
field1: "field1"
register: _result

- name: Check credential type update
assert:
that:
- _result.changed

- name: Update credential type again
ansible.eda.credential_type:
<<: *credential_defaults
name: "{{ new_credential_type_name }}"
new_name: "{{ new_credential_type_name }}"
state: present
description: "A test credential type"
inputs:
fields:
- id: "field1"
type: "string"
label: "Field 5"
injectors:
extra_vars:
field1: "field1"
register: _result

- name: Check credential type is not updated again
assert:
that:
- not _result.changed

# DELETE
- name: Delete operation type without required name parameter
ansible.eda.credential_type:
<<: *credential_defaults
state: absent
ignore_errors: true
register: _result

- name: Check if credential type name is required
assert:
that:
- _result.failed
- "'missing required arguments: name' in _result.msg"

- name: Delete non-existing credential type in check mode
ansible.eda.credential_type:
<<: *credential_defaults
name: "Example2"
state: absent
check_mode: true
register: _result

- name: Check if delete non-existing credential type in check mode
assert:
that:
- not _result.changed

- name: Delete credential type
ansible.eda.credential_type:
<<: *credential_defaults
name: "{{ new_credential_type_name }}"
state: absent
register: _result

- name: Check if delete non-existing credential type
assert:
that:
- _result.changed
- name: Credential type integration tests
module_defaults:
group/ansible.eda.eda:
controller_host: "{{ controller_host }}"
controller_username: "{{ controller_username }}"
controller_password: "{{ controller_password }}"
validate_certs: "{{ controller_verify_ssl }}"
block:
- name: Generate a random_string for the test
set_fact:
random_string: "{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}"
when: random_string is not defined

- name: Generate a ID for the test
set_fact:
test_id: "{{ random_string | to_uuid }}"
when: test_id is not defined

- name: Define variables for credential and project
set_fact:
credential_type_name: "Test_CredentialType_{{ test_id }}"
new_credential_type_name: "New_Test_CredentialType_{{ test_id }}"

# CREATE
- name: Create credential type in check mode
ansible.eda.credential_type:
name: "{{ credential_type_name }}"
state: present
description: "A test credential type"
inputs:
fields:
- id: "field1"
type: "string"
label: "Field 5"
injectors:
extra_vars:
field1: "field1"
check_mode: true
register: _result

- name: Check credential type creation in check mode
assert:
that:
- _result.changed

- name: Create credential type
ansible.eda.credential_type:
name: "{{ credential_type_name }}"
state: present
description: "A test credential type"
inputs:
fields:
- id: "field1"
type: "string"
label: "Field 5"
injectors:
extra_vars:
field1: "field1"
register: _result

- name: Check credential type creation
assert:
that:
- _result.changed

- name: Create credential type again
ansible.eda.credential_type:
name: "{{ credential_type_name }}"
state: present
description: "A test credential type"
inputs:
fields:
- id: "field1"
type: "string"
label: "Field 5"
injectors:
extra_vars:
field1: "field1"
register: _result

- name: Check credential type is not created again
assert:
that:
- not _result.changed

- name: Get info about a credential type
ansible.eda.credential_type_info:
name: "{{ credential_type_name }}"

# UPDATE
- name: Update credential type name
ansible.eda.credential_type:
name: "{{ credential_type_name }}"
new_name: "{{ new_credential_type_name }}"
state: present
description: "A test credential type"
inputs:
fields:
- id: "field1"
type: "string"
label: "Field 5"
injectors:
extra_vars:
field1: "field1"
register: _result

- name: Check credential type update
assert:
that:
- _result.changed

- name: Update credential type again
ansible.eda.credential_type:
name: "{{ new_credential_type_name }}"
new_name: "{{ new_credential_type_name }}"
state: present
description: "A test credential type"
inputs:
fields:
- id: "field1"
type: "string"
label: "Field 5"
injectors:
extra_vars:
field1: "field1"
register: _result

- name: Check credential type is not updated again
assert:
that:
- not _result.changed

# DELETE
- name: Delete operation type without required name parameter
ansible.eda.credential_type:
state: absent
ignore_errors: true
register: _result

- name: Check if credential type name is required
assert:
that:
- _result.failed
- "'missing required arguments: name' in _result.msg"

- name: Delete non-existing credential type in check mode
ansible.eda.credential_type:
name: "Example2"
state: absent
check_mode: true
register: _result

- name: Check if delete non-existing credential type in check mode
assert:
that:
- not _result.changed

- name: Delete credential type
ansible.eda.credential_type:
name: "{{ new_credential_type_name }}"
state: absent
register: _result

- name: Check if delete non-existing credential type
assert:
that:
- _result.changed

always:
- name: Clean up - credential type
ansible.eda.credential_type:
<<: *credential_defaults
name: "{{ item }}"
state: absent
loop:
20 changes: 0 additions & 20 deletions tests/integration/targets/decision_environment/tasks/create.yml
Original file line number Diff line number Diff line change
@@ -4,10 +4,6 @@

- name: Create decision environment in check mode
ansible.eda.decision_environment:
controller_host: "{{ controller_host }}"
controller_username: "{{ controller_username }}"
controller_password: "{{ controller_password }}"
validate_certs: "{{ controller_verify_ssl }}"
name: "{{ decision_env_name }}"
description: "Example decision environment description"
image_url: "{{ image_url }}"
@@ -23,10 +19,6 @@

- name: Create decision environment
ansible.eda.decision_environment:
controller_host: "{{ controller_host }}"
controller_username: "{{ controller_username }}"
controller_password: "{{ controller_password }}"
validate_certs: "{{ controller_verify_ssl }}"
name: "{{ decision_env_name }}"
description: "Example decision environment description"
image_url: "{{ image_url }}"
@@ -41,10 +33,6 @@

- name: Create decision environment again
ansible.eda.decision_environment:
controller_host: "{{ controller_host }}"
controller_username: "{{ controller_username }}"
controller_password: "{{ controller_password }}"
validate_certs: "{{ controller_verify_ssl }}"
name: "{{ decision_env_name }}"
description: "Example decision environment description"
image_url: "{{ image_url }}"
@@ -59,10 +47,6 @@

- name: Delete decision environment in check mode
ansible.eda.decision_environment:
controller_host: "{{ controller_host }}"
controller_username: "{{ controller_username }}"
controller_password: "{{ controller_password }}"
validate_certs: "{{ controller_verify_ssl }}"
name: "{{ decision_env_name }}"
state: absent
check_mode: true
@@ -75,10 +59,6 @@

- name: Delete decision environment
ansible.eda.decision_environment:
controller_host: "{{ controller_host }}"
controller_username: "{{ controller_username }}"
controller_password: "{{ controller_password }}"
validate_certs: "{{ controller_verify_ssl }}"
name: "{{ decision_env_name }}"
state: absent
register: r
12 changes: 0 additions & 12 deletions tests/integration/targets/decision_environment/tasks/delete.yml
Original file line number Diff line number Diff line change
@@ -4,10 +4,6 @@

- name: Delete operation without required name parameter
ansible.eda.decision_environment:
controller_host: "{{ controller_host }}"
controller_username: "{{ controller_username }}"
controller_password: "{{ controller_password }}"
validate_certs: "{{ controller_verify_ssl }}"
state: absent
ignore_errors: true
register: r
@@ -20,10 +16,6 @@

- name: Delete non-existing decision environment in check mode
ansible.eda.decision_environment:
controller_host: "{{ controller_host }}"
controller_username: "{{ controller_username }}"
controller_password: "{{ controller_password }}"
validate_certs: "{{ controller_verify_ssl }}"
name: Example
state: absent
check_mode: true
@@ -36,10 +28,6 @@

- name: Delete non-existing decision environment
ansible.eda.decision_environment:
controller_host: "{{ controller_host }}"
controller_username: "{{ controller_username }}"
controller_password: "{{ controller_password }}"
validate_certs: "{{ controller_verify_ssl }}"
name: Example
state: absent
register: r
13 changes: 8 additions & 5 deletions tests/integration/targets/decision_environment/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -2,7 +2,14 @@
# Copyright: Contributors to the Ansible project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)

- block:
- name: Decision environment integration tests
module_defaults:
group/ansible.eda.eda:
controller_host: "{{ controller_host }}"
controller_username: "{{ controller_username }}"
controller_password: "{{ controller_password }}"
validate_certs: "{{ controller_verify_ssl }}"
block:
- name: Generate a random_string for the test
set_fact:
random_string: "{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}"
@@ -24,10 +31,6 @@
always:
- name: Clean up - decision environment
ansible.eda.decision_environment:
controller_host: "{{ controller_host }}"
controller_username: "{{ controller_username }}"
controller_password: "{{ controller_password }}"
validate_certs: "{{ controller_verify_ssl }}"
name: "{{ item }}"
state: absent
loop:
16 changes: 0 additions & 16 deletions tests/integration/targets/decision_environment/tasks/update.yml
Original file line number Diff line number Diff line change
@@ -4,10 +4,6 @@

- name: Create decision environment
ansible.eda.decision_environment:
controller_host: "{{ controller_host }}"
controller_username: "{{ controller_username }}"
controller_password: "{{ controller_password }}"
validate_certs: "{{ controller_verify_ssl }}"
name: "{{ decision_env_name }}"
description: "Example decision environment description"
image_url: "{{ image_url }}"
@@ -22,10 +18,6 @@

- name: Update decision environment name
ansible.eda.decision_environment:
controller_host: "{{ controller_host }}"
controller_username: "{{ controller_username }}"
controller_password: "{{ controller_password }}"
validate_certs: "{{ controller_verify_ssl }}"
name: "{{ decision_env_name }}"
new_name: "{{ decision_env_name }}_new"
description: "Example decision environment description"
@@ -41,10 +33,6 @@

- name: Update decision environment again
ansible.eda.decision_environment:
controller_host: "{{ controller_host }}"
controller_username: "{{ controller_username }}"
controller_password: "{{ controller_password }}"
validate_certs: "{{ controller_verify_ssl }}"
name: "{{ decision_env_name }}_new"
new_name: "{{ decision_env_name }}_new"
description: "Example decision environment description"
@@ -60,10 +48,6 @@

- name: Delete updated decision environment
ansible.eda.decision_environment:
controller_host: "{{ controller_host }}"
controller_username: "{{ controller_username }}"
controller_password: "{{ controller_password }}"
validate_certs: "{{ controller_verify_ssl }}"
name: "{{ decision_env_name }}_new"
state: absent
register: r
20 changes: 0 additions & 20 deletions tests/integration/targets/decision_environment_info/tasks/list.yml
Original file line number Diff line number Diff line change
@@ -4,10 +4,6 @@

- name: Create decision environment
ansible.eda.decision_environment:
controller_host: "{{ controller_host }}"
controller_username: "{{ controller_username }}"
controller_password: "{{ controller_password }}"
validate_certs: "{{ controller_verify_ssl }}"
name: "{{ decision_env_name }}"
description: "Example decision environment description"
image_url: "{{ image_url }}"
@@ -22,10 +18,6 @@

- name: List all decision environments in check mode
ansible.eda.decision_environment_info:
controller_host: "{{ controller_host }}"
controller_username: "{{ controller_username }}"
controller_password: "{{ controller_password }}"
validate_certs: "{{ controller_verify_ssl }}"
check_mode: true
register: r

@@ -37,10 +29,6 @@

- name: List all decision environments
ansible.eda.decision_environment_info:
controller_host: "{{ controller_host }}"
controller_username: "{{ controller_username }}"
controller_password: "{{ controller_password }}"
validate_certs: "{{ controller_verify_ssl }}"
register: r

- name: Check if list decision environments
@@ -51,10 +39,6 @@

- name: List a particular decision environment
ansible.eda.decision_environment_info:
controller_host: "{{ controller_host }}"
controller_username: "{{ controller_username }}"
controller_password: "{{ controller_password }}"
validate_certs: "{{ controller_verify_ssl }}"
name: "{{ decision_env_name }}"
register: r

@@ -67,10 +51,6 @@

- name: Delete decision environment
ansible.eda.decision_environment:
controller_host: "{{ controller_host }}"
controller_username: "{{ controller_username }}"
controller_password: "{{ controller_password }}"
validate_certs: "{{ controller_verify_ssl }}"
name: "{{ decision_env_name }}"
state: absent
register: r
Original file line number Diff line number Diff line change
@@ -2,7 +2,15 @@
# Copyright: Contributors to the Ansible project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)

- block:
- name: Decision environment info module integration tests
module_defaults:
group/ansible.eda.eda:
controller_host: "{{ controller_host }}"
controller_username: "{{ controller_username }}"
controller_password: "{{ controller_password }}"
validate_certs: "{{ controller_verify_ssl }}"

block:
- name: Generate a random_string for the test
set_fact:
random_string: "{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}"
@@ -22,10 +30,6 @@
always:
- name: Clean up - decision environment
ansible.eda.decision_environment:
controller_host: "{{ controller_host }}"
controller_username: "{{ controller_username }}"
controller_password: "{{ controller_password }}"
validate_certs: "{{ controller_verify_ssl }}"
name: "{{ item }}"
state: absent
loop:
20 changes: 0 additions & 20 deletions tests/integration/targets/project/tasks/create.yml
Original file line number Diff line number Diff line change
@@ -4,10 +4,6 @@

- name: Create project in check mode
ansible.eda.project:
controller_host: "{{ controller_host }}"
controller_username: "{{ controller_username }}"
controller_password: "{{ controller_password }}"
validate_certs: "{{ controller_verify_ssl }}"
name: "{{ project_name }}"
url: "{{ url }}"
description: "Example project description"
@@ -23,10 +19,6 @@

- name: Create project
ansible.eda.project:
controller_host: "{{ controller_host }}"
controller_username: "{{ controller_username }}"
controller_password: "{{ controller_password }}"
validate_certs: "{{ controller_verify_ssl }}"
name: "{{ project_name }}"
url: "{{ url }}"
description: "Example project description"
@@ -41,10 +33,6 @@

- name: Create project again
ansible.eda.project:
controller_host: "{{ controller_host }}"
controller_username: "{{ controller_username }}"
controller_password: "{{ controller_password }}"
validate_certs: "{{ controller_verify_ssl }}"
name: "{{ project_name }}"
url: "{{ url }}"
description: "Example project description"
@@ -59,10 +47,6 @@

- name: Delete project in check mode
ansible.eda.project:
controller_host: "{{ controller_host }}"
controller_username: "{{ controller_username }}"
controller_password: "{{ controller_password }}"
validate_certs: "{{ controller_verify_ssl }}"
name: "{{ project_name }}"
state: absent
check_mode: true
@@ -75,10 +59,6 @@

- name: Delete project
ansible.eda.project:
controller_host: "{{ controller_host }}"
controller_username: "{{ controller_username }}"
controller_password: "{{ controller_password }}"
validate_certs: "{{ controller_verify_ssl }}"
name: "{{ project_name }}"
state: absent
register: r
4 changes: 0 additions & 4 deletions tests/integration/targets/project/tasks/delete.yml
Original file line number Diff line number Diff line change
@@ -35,10 +35,6 @@

- name: Delete non-existing project
ansible.eda.project:
controller_host: "{{ controller_host }}"
controller_username: "{{ controller_username }}"
controller_password: "{{ controller_password }}"
validate_certs: "{{ controller_verify_ssl }}"
name: "{{ project_name }}_ee"
state: absent
register: r
14 changes: 8 additions & 6 deletions tests/integration/targets/project/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
---
# Copyright: Contributors to the Ansible project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)

- block:
- name: Project integration tests
module_defaults:
group/ansible.eda.eda:
controller_host: "{{ controller_host }}"
controller_username: "{{ controller_username }}"
controller_password: "{{ controller_password }}"
validate_certs: "{{ controller_verify_ssl }}"
block:
- name: Generate a random_string for the test
set_fact:
random_string: "{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}"
@@ -24,10 +30,6 @@
always:
- name: Clean up - project
ansible.eda.project:
controller_host: "{{ controller_host }}"
controller_username: "{{ controller_username }}"
controller_password: "{{ controller_password }}"
validate_certs: "{{ controller_verify_ssl }}"
name: "{{ item }}"
state: absent
loop:
16 changes: 0 additions & 16 deletions tests/integration/targets/project/tasks/update.yml
Original file line number Diff line number Diff line change
@@ -4,10 +4,6 @@

- name: Create project
ansible.eda.project:
controller_host: "{{ controller_host }}"
controller_username: "{{ controller_username }}"
controller_password: "{{ controller_password }}"
validate_certs: "{{ controller_verify_ssl }}"
name: "{{ project_name }}"
url: "{{ url }}"
description: "Example project description"
@@ -22,10 +18,6 @@

- name: Update project name
ansible.eda.project:
controller_host: "{{ controller_host }}"
controller_username: "{{ controller_username }}"
controller_password: "{{ controller_password }}"
validate_certs: "{{ controller_verify_ssl }}"
name: "{{ project_name }}"
url: "{{ url }}"
new_name: "{{ project_name }}_new"
@@ -41,10 +33,6 @@

- name: Update project again
ansible.eda.project:
controller_host: "{{ controller_host }}"
controller_username: "{{ controller_username }}"
controller_password: "{{ controller_password }}"
validate_certs: "{{ controller_verify_ssl }}"
name: "{{ project_name }}_new"
new_name: "{{ project_name }}_new"
description: "Example project description"
@@ -60,10 +48,6 @@

- name: Delete updated project
ansible.eda.project:
controller_host: "{{ controller_host }}"
controller_username: "{{ controller_username }}"
controller_password: "{{ controller_password }}"
validate_certs: "{{ controller_verify_ssl }}"
name: "{{ project_name }}_new"
state: absent
register: r
4 changes: 0 additions & 4 deletions tests/integration/targets/project_info/tasks/create.yml
Original file line number Diff line number Diff line change
@@ -4,10 +4,6 @@

- name: Create a project
ansible.eda.project:
controller_host: "{{ controller_host }}"
controller_username: "{{ controller_username }}"
controller_password: "{{ controller_password }}"
validate_certs: "{{ controller_verify_ssl }}"
name: Example
description: "Example project description"
url: "https://example.com/project1"
30 changes: 9 additions & 21 deletions tests/integration/targets/project_info/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -2,14 +2,18 @@
# Copyright: Contributors to the Ansible project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)

- block:
- name: Project info module integration tests
module_defaults:
group/ansible.eda.eda:
controller_host: "{{ controller_host }}"
controller_username: "{{ controller_username }}"
controller_password: "{{ controller_password }}"
validate_certs: "{{ controller_verify_ssl }}"

block:
- include_tasks: create.yml
- name: List all projects in the given EDA Controller in check mode
ansible.eda.project_info:
controller_host: "{{ controller_host }}"
controller_username: "{{ controller_username }}"
controller_password: "{{ controller_password }}"
validate_certs: "{{ controller_verify_ssl }}"
check_mode: true
register: r

@@ -20,10 +24,6 @@

- name: List all projects in the given EDA Controller
ansible.eda.project_info:
controller_host: "{{ controller_host }}"
controller_username: "{{ controller_username }}"
controller_password: "{{ controller_password }}"
validate_certs: "{{ controller_verify_ssl }}"
register: r

- name: Check if all the projects are returned
@@ -33,10 +33,6 @@

- name: List a particular project in the given EDA Controller
ansible.eda.project_info:
controller_host: "{{ controller_host }}"
controller_username: "{{ controller_username }}"
controller_password: "{{ controller_password }}"
validate_certs: "{{ controller_verify_ssl }}"
name: "Example"
register: r

@@ -48,10 +44,6 @@

- name: List a non-existing particular project in the given EDA Controller
ansible.eda.project_info:
controller_host: "{{ controller_host }}"
controller_username: "{{ controller_username }}"
controller_password: "{{ controller_password }}"
validate_certs: "{{ controller_verify_ssl }}"
name: "Example2"
register: r

@@ -64,10 +56,6 @@
always:
- name: Clean up - project
ansible.eda.project:
controller_host: "{{ controller_host }}"
controller_username: "{{ controller_username }}"
controller_password: "{{ controller_password }}"
validate_certs: "{{ controller_verify_ssl }}"
name: "{{ item }}"
state: absent
loop:
32 changes: 0 additions & 32 deletions tests/integration/targets/user/tasks/create.yml
Original file line number Diff line number Diff line change
@@ -4,10 +4,6 @@

- name: Create super user in check mode
ansible.eda.user:
controller_host: "{{ controller_host }}"
controller_username: "{{ controller_username }}"
controller_password: "{{ controller_password }}"
validate_certs: "{{ controller_verify_ssl }}"
username: "{{ user_name }}"
first_name: "{{ first_name }}"
last_name: "{{ last_name }}"
@@ -25,10 +21,6 @@

- name: Create super user
ansible.eda.user:
controller_host: "{{ controller_host }}"
controller_username: "{{ controller_username }}"
controller_password: "{{ controller_password }}"
validate_certs: "{{ controller_verify_ssl }}"
username: "{{ user_name }}"
first_name: "{{ first_name }}"
last_name: "{{ last_name }}"
@@ -45,10 +37,6 @@

- name: Create super user again
ansible.eda.user:
controller_host: "{{ controller_host }}"
controller_username: "{{ controller_username }}"
controller_password: "{{ controller_password }}"
validate_certs: "{{ controller_verify_ssl }}"
username: "{{ user_name }}"
first_name: "{{ first_name }}"
last_name: "{{ last_name }}"
@@ -65,10 +53,6 @@

- name: Delete super user
ansible.eda.user:
controller_host: "{{ controller_host }}"
controller_username: "{{ controller_username }}"
controller_password: "{{ controller_password }}"
vvalidate_certs: "{{ controller_verify_ssl }}"
username: "{{ user_name }}"
state: absent
register: r
@@ -80,10 +64,6 @@

- name: Create normal user in check mode
ansible.eda.user:
controller_host: "{{ controller_host }}"
controller_username: "{{ controller_username }}"
controller_password: "{{ controller_password }}"
validate_certs: "{{ controller_verify_ssl }}"
username: "{{ user_name }}"
first_name: "{{ first_name }}"
last_name: "{{ last_name }}"
@@ -101,10 +81,6 @@

- name: Create normal user
ansible.eda.user:
controller_host: "{{ controller_host }}"
controller_username: "{{ controller_username }}"
controller_password: "{{ controller_password }}"
validate_certs: "{{ controller_verify_ssl }}"
username: "{{ user_name }}"
first_name: "{{ first_name }}"
last_name: "{{ last_name }}"
@@ -121,10 +97,6 @@

- name: Create normal user again
ansible.eda.user:
controller_host: "{{ controller_host }}"
controller_username: "{{ controller_username }}"
controller_password: "{{ controller_password }}"
validate_certs: "{{ controller_verify_ssl }}"
username: "{{ user_name }}"
first_name: "{{ first_name }}"
last_name: "{{ last_name }}"
@@ -141,10 +113,6 @@

- name: Delete normal user
ansible.eda.user:
controller_host: "{{ controller_host }}"
controller_username: "{{ controller_username }}"
controller_password: "{{ controller_password }}"
validate_certs: "{{ controller_verify_ssl }}"
username: "{{ user_name }}"
state: absent
register: r
13 changes: 8 additions & 5 deletions tests/integration/targets/user/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -2,7 +2,14 @@
# Copyright: Contributors to the Ansible project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)

- block:
- name: User integration tests
module_defaults:
group/ansible.eda.eda:
controller_host: "{{ controller_host }}"
controller_username: "{{ controller_username }}"
controller_password: "{{ controller_password }}"
validate_certs: "{{ controller_verify_ssl }}"
block:
- name: Generate a random_string for the test
set_fact:
random_string: "{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}"
@@ -20,10 +27,6 @@
always:
- name: Clean up - user
ansible.eda.project:
controller_host: "{{ controller_host }}"
controller_username: "{{ controller_username }}"
controller_password: "{{ controller_password }}"
validate_certs: "{{ controller_verify_ssl }}"
name: "{{ item }}"
state: absent
loop:
12 changes: 0 additions & 12 deletions tests/integration/targets/user/tasks/update.yml
Original file line number Diff line number Diff line change
@@ -4,10 +4,6 @@

- name: Create super user
ansible.eda.user:
controller_host: "{{ controller_host }}"
controller_username: "{{ controller_username }}"
controller_password: "{{ controller_password }}"
validate_certs: "{{ controller_verify_ssl }}"
username: "{{ user_name }}"
first_name: "{{ first_name }}"
last_name: "{{ last_name }}"
@@ -24,10 +20,6 @@

- name: Update super user
ansible.eda.user:
controller_host: "{{ controller_host }}"
controller_username: "{{ controller_username }}"
controller_password: "{{ controller_password }}"
validate_certs: "{{ controller_verify_ssl }}"
username: "{{ user_name }}"
new_username: "{{ user_name }}_new"
first_name: "{{ first_name }}_new"
@@ -45,10 +37,6 @@

- name: Delete super user
ansible.eda.user:
controller_host: "{{ controller_host }}"
controller_username: "{{ controller_username }}"
controller_password: "{{ controller_password }}"
validate_certs: "{{ controller_verify_ssl }}"
username: "{{ user_name }}_new"
state: absent
register: r

0 comments on commit 1b78080

Please sign in to comment.