diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 99d8941..9bbbd0a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -20,7 +20,7 @@ repos: types: - yaml - repo: https://github.com/psf/black - rev: 24.4.2 + rev: 24.8.0 hooks: - id: black name: black diff --git a/tests/integration/targets/quay_api_token/meta/main.yml b/tests/integration/targets/quay_api_token/meta/main.yml index e978127..6f61d07 100644 --- a/tests/integration/targets/quay_api_token/meta/main.yml +++ b/tests/integration/targets/quay_api_token/meta/main.yml @@ -1,4 +1,4 @@ --- dependencies: - - setup_token + - setup_organization ... diff --git a/tests/integration/targets/quay_api_token/tasks/main.yml b/tests/integration/targets/quay_api_token/tasks/main.yml index ca2754f..4bd7d29 100644 --- a/tests/integration/targets/quay_api_token/tasks/main.yml +++ b/tests/integration/targets/quay_api_token/tasks/main.yml @@ -1,43 +1,33 @@ --- -# Supporting organization -- name: Ensure organization ansibletestorg exists - infra.quay_configuration.quay_organization: - name: ansibletestorg - email: ansibletestorg@example.com - state: present - quay_host: "{{ quay_url }}" - quay_token: "{{ quay_token }}" - validate_certs: false - # Supporting user account -- name: Ensure ansibletestuser1 user account exists +- name: Ensure testuser1 user account exists infra.quay_configuration.quay_user: - username: ansibletestuser1 + username: testuser1 password: vs9mrD55NP - email: ansibletestuser1@example.com + email: testuser1@example.com state: present quay_host: "{{ quay_url }}" quay_token: "{{ quay_token }}" validate_certs: false # Supporting team -- name: Ensure ansibletestteam1 team exists +- name: Ensure testteam1 team exists infra.quay_configuration.quay_team: - name: ansibletestteam1 + name: testteam1 organization: ansibletestorg role: admin members: - - ansibletestuser1 + - testuser1 state: present quay_host: "{{ quay_url }}" quay_token: "{{ quay_token }}" validate_certs: false # Supporting application -- name: Ensure the ansibletestapp1 application exists +- name: Ensure the testapp11 application exists infra.quay_configuration.quay_application: organization: ansibletestorg - name: ansibletestapp1 + name: testapp11 state: present quay_host: "{{ quay_url }}" quay_token: "{{ quay_token }}" @@ -46,7 +36,7 @@ - name: Generate an OAuth access token for the user infra.quay_configuration.quay_api_token: - quay_username: ansibletestuser1 + quay_username: testuser1 quay_password: vs9mrD55NP client_id: "{{ app_details['client_id'] }}" rights: @@ -60,18 +50,18 @@ that: "'access_token' in result" fail_msg: The result should have the access_token key -- name: Ensure ansibletestteam1 team is removed +- name: Ensure testteam1 team is removed infra.quay_configuration.quay_team: - name: ansibletestteam1 + name: testteam1 organization: ansibletestorg state: absent quay_host: "{{ quay_url }}" quay_token: "{{ quay_token }}" validate_certs: false -- name: Ensure ansibletestuser1 user account is removed +- name: Ensure testuser1 user account is removed infra.quay_configuration.quay_user: - username: ansibletestuser1 + username: testuser1 state: absent quay_host: "{{ quay_url }}" quay_token: "{{ quay_token }}" @@ -80,19 +70,9 @@ - name: Ensure the application is removed infra.quay_configuration.quay_application: organization: ansibletestorg - name: ansibletestapp1 + name: testapp11 state: absent quay_host: "{{ quay_url }}" quay_token: "{{ quay_token }}" validate_certs: false - -- name: Ensure the organization is removed - infra.quay_configuration.quay_organization: - name: ansibletestorg - state: absent - quay_host: "{{ quay_url }}" - # For testing, authenticating with username/password instead of the token - quay_username: "{{ admin_username }}" - quay_password: "{{ admin_password }}" - validate_certs: false ... diff --git a/tests/integration/targets/quay_application/meta/main.yml b/tests/integration/targets/quay_application/meta/main.yml index e978127..6f61d07 100644 --- a/tests/integration/targets/quay_application/meta/main.yml +++ b/tests/integration/targets/quay_application/meta/main.yml @@ -1,4 +1,4 @@ --- dependencies: - - setup_token + - setup_organization ... diff --git a/tests/integration/targets/quay_application/tasks/main.yml b/tests/integration/targets/quay_application/tasks/main.yml index 836df52..04b5218 100644 --- a/tests/integration/targets/quay_application/tasks/main.yml +++ b/tests/integration/targets/quay_application/tasks/main.yml @@ -1,14 +1,4 @@ --- -# Supporting organization -- name: Ensure organization ansibletestorg exists - infra.quay_configuration.quay_organization: - name: ansibletestorg - email: ansibletestorg@example.com - state: present - quay_host: "{{ quay_url }}" - quay_token: "{{ quay_token }}" - validate_certs: false - - name: Ensure the application ansibletestapp1 exists infra.quay_configuration.quay_application: organization: ansibletestorg @@ -126,14 +116,4 @@ - ansibletestapp1 - ansibletestapp2 - ansibletestapp3 - -- name: Ensure the organization is removed - infra.quay_configuration.quay_organization: - name: ansibletestorg - state: absent - quay_host: "{{ quay_url }}" - # For testing, authenticating with username/password instead of the token - quay_username: "{{ admin_username }}" - quay_password: "{{ admin_password }}" - validate_certs: false ... diff --git a/tests/integration/targets/quay_default_perm/meta/main.yml b/tests/integration/targets/quay_default_perm/meta/main.yml index e978127..6f61d07 100644 --- a/tests/integration/targets/quay_default_perm/meta/main.yml +++ b/tests/integration/targets/quay_default_perm/meta/main.yml @@ -1,4 +1,4 @@ --- dependencies: - - setup_token + - setup_organization ... diff --git a/tests/integration/targets/quay_default_perm/tasks/main.yml b/tests/integration/targets/quay_default_perm/tasks/main.yml index 7bb2d96..c2c5407 100644 --- a/tests/integration/targets/quay_default_perm/tasks/main.yml +++ b/tests/integration/targets/quay_default_perm/tasks/main.yml @@ -1,50 +1,4 @@ --- -# Supporting organization -- name: Ensure organization ansibletestorg exists - infra.quay_configuration.quay_organization: - name: ansibletestorg - email: ansibletestorg@example.com - state: present - quay_host: "{{ quay_url }}" - quay_token: "{{ quay_token }}" - validate_certs: false - -# Supporting user accounts -- name: Ensure user accounts exist - infra.quay_configuration.quay_user: - username: "{{ item }}" - email: "{{ item }}@example.com" - state: present - quay_host: "{{ quay_url }}" - quay_token: "{{ quay_token }}" - validate_certs: false - loop: - - ansibletestuser1 - - ansibletestuser2 - -# Supporting robot accounts -- name: Ensure the robot accounts exist - infra.quay_configuration.quay_robot: - name: ansibletestorg+ansibletestrobot1 - state: present - quay_host: "{{ quay_url }}" - quay_token: "{{ quay_token }}" - validate_certs: false - -# Supporting team -- name: Ensure teams exist - infra.quay_configuration.quay_team: - name: "{{ item }}" - organization: ansibletestorg - role: admin - state: present - quay_host: "{{ quay_url }}" - quay_token: "{{ quay_token }}" - validate_certs: false - loop: - - ansibletestteam1 - - ansibletestteam2 - - name: Ensure default perm anon-read-ansibletestuser1 exists infra.quay_configuration.quay_default_perm: organization: ansibletestorg @@ -226,45 +180,4 @@ quay_host: "{{ quay_url }}" quay_token: "{{ quay_token }}" validate_certs: false - -- name: Ensure the teams are removed - infra.quay_configuration.quay_team: - name: "{{ item }}" - organization: ansibletestorg - state: absent - quay_host: "{{ quay_url }}" - quay_token: "{{ quay_token }}" - validate_certs: false - loop: - - ansibletestteam1 - - ansibletestteam2 - -- name: Ensure user accounts are removed - infra.quay_configuration.quay_user: - username: "{{ item }}" - state: absent - quay_host: "{{ quay_url }}" - quay_token: "{{ quay_token }}" - validate_certs: false - loop: - - ansibletestuser1 - - ansibletestuser2 - -- name: Ensure the robot accounts are removed - infra.quay_configuration.quay_robot: - name: ansibletestorg+ansibletestrobot1 - state: absent - quay_host: "{{ quay_url }}" - quay_token: "{{ quay_token }}" - validate_certs: false - -- name: Ensure the organization is removed - infra.quay_configuration.quay_organization: - name: ansibletestorg - state: absent - quay_host: "{{ quay_url }}" - # For testing, authenticating with username/password instead of the token - quay_username: "{{ admin_username }}" - quay_password: "{{ admin_password }}" - validate_certs: false ... diff --git a/tests/integration/targets/quay_layer_info/tasks/main.yml b/tests/integration/targets/quay_layer_info/tasks/main.yml index 9d67aaa..6763cf8 100644 --- a/tests/integration/targets/quay_layer_info/tasks/main.yml +++ b/tests/integration/targets/quay_layer_info/tasks/main.yml @@ -44,3 +44,4 @@ ansible.builtin.assert: that: not result['changed'] fail_msg: The preceding task should not have changed anything +... diff --git a/tests/integration/targets/quay_manifest_label/meta/main.yml b/tests/integration/targets/quay_manifest_label/meta/main.yml index e978127..6f61d07 100644 --- a/tests/integration/targets/quay_manifest_label/meta/main.yml +++ b/tests/integration/targets/quay_manifest_label/meta/main.yml @@ -1,4 +1,4 @@ --- dependencies: - - setup_token + - setup_organization ... diff --git a/tests/integration/targets/quay_manifest_label/tasks/main.yml b/tests/integration/targets/quay_manifest_label/tasks/main.yml index ba5ea7d..72026d9 100644 --- a/tests/integration/targets/quay_manifest_label/tasks/main.yml +++ b/tests/integration/targets/quay_manifest_label/tasks/main.yml @@ -1,14 +1,4 @@ --- -# Supporting organization -- name: Ensure organization ansibletestorg exists - infra.quay_configuration.quay_organization: - name: ansibletestorg - email: ansibletestorg@example.com - state: present - quay_host: "{{ quay_url }}" - quay_token: "{{ quay_token }}" - validate_certs: false - - name: Check whether podman is available ansible.builtin.command: cmd: podman --version @@ -255,14 +245,4 @@ quay_host: "{{ quay_url }}" quay_token: "{{ quay_token }}" validate_certs: false - -- name: Ensure the organization is removed - infra.quay_configuration.quay_organization: - name: ansibletestorg - state: absent - quay_host: "{{ quay_url }}" - # For testing, authenticating with username/password instead of the token - quay_username: "{{ admin_username }}" - quay_password: "{{ admin_password }}" - validate_certs: false ... diff --git a/tests/integration/targets/quay_manifest_label_info/tasks/main.yml b/tests/integration/targets/quay_manifest_label_info/tasks/main.yml index 5502eb5..21eaf30 100644 --- a/tests/integration/targets/quay_manifest_label_info/tasks/main.yml +++ b/tests/integration/targets/quay_manifest_label_info/tasks/main.yml @@ -54,3 +54,4 @@ ansible.builtin.assert: that: labels['labels']|length == 0 fail_msg: The preceding task should not have returned labels +... diff --git a/tests/integration/targets/quay_notification/meta/main.yml b/tests/integration/targets/quay_notification/meta/main.yml index e978127..6f61d07 100644 --- a/tests/integration/targets/quay_notification/meta/main.yml +++ b/tests/integration/targets/quay_notification/meta/main.yml @@ -1,4 +1,4 @@ --- dependencies: - - setup_token + - setup_organization ... diff --git a/tests/integration/targets/quay_notification/tasks/main.yml b/tests/integration/targets/quay_notification/tasks/main.yml index 84d3e26..64891ce 100644 --- a/tests/integration/targets/quay_notification/tasks/main.yml +++ b/tests/integration/targets/quay_notification/tasks/main.yml @@ -1,35 +1,4 @@ --- -# Supporting organization -- name: Ensure organization ansibletestorg exists - infra.quay_configuration.quay_organization: - name: ansibletestorg - email: ansibletestorg@example.com - state: present - quay_host: "{{ quay_url }}" - quay_token: "{{ quay_token }}" - validate_certs: false - -# Supporting user account -- name: Ensure user accounts exist - infra.quay_configuration.quay_user: - username: ansibletestuser1 - email: "ansibletestuser1@example.com" - state: present - quay_host: "{{ quay_url }}" - quay_token: "{{ quay_token }}" - validate_certs: false - -# Supporting team -- name: Ensure teams exist - infra.quay_configuration.quay_team: - name: ansibletestteam1 - organization: ansibletestorg - role: admin - state: present - quay_host: "{{ quay_url }}" - quay_token: "{{ quay_token }}" - validate_certs: false - # Supporting repository - name: Ensure repository ansibletestrepo exists infra.quay_configuration.quay_repository: @@ -261,30 +230,4 @@ quay_host: "{{ quay_url }}" quay_token: "{{ quay_token }}" validate_certs: false - -- name: Ensure the team is removed - infra.quay_configuration.quay_team: - name: ansibletestteam1 - organization: ansibletestorg - state: absent - quay_host: "{{ quay_url }}" - quay_token: "{{ quay_token }}" - validate_certs: false - -- name: Ensure user account is removed - infra.quay_configuration.quay_user: - username: ansibletestuser1 - state: absent - quay_host: "{{ quay_url }}" - quay_token: "{{ quay_token }}" - validate_certs: false - -- name: Ensure the organization is removed - infra.quay_configuration.quay_organization: - name: ansibletestorg - state: absent - quay_host: "{{ quay_url }}" - # For testing, authenticating with username/password instead of the token - quay_username: "{{ admin_username }}" - quay_password: "{{ admin_password }}" - validate_certs: false +... diff --git a/tests/integration/targets/quay_proxy_cache/meta/main.yml b/tests/integration/targets/quay_proxy_cache/meta/main.yml index e978127..6f61d07 100644 --- a/tests/integration/targets/quay_proxy_cache/meta/main.yml +++ b/tests/integration/targets/quay_proxy_cache/meta/main.yml @@ -1,4 +1,4 @@ --- dependencies: - - setup_token + - setup_organization ... diff --git a/tests/integration/targets/quay_proxy_cache/tasks/main.yml b/tests/integration/targets/quay_proxy_cache/tasks/main.yml index 183aeba..2a10445 100644 --- a/tests/integration/targets/quay_proxy_cache/tasks/main.yml +++ b/tests/integration/targets/quay_proxy_cache/tasks/main.yml @@ -1,14 +1,4 @@ --- -# Supporting organization -- name: Ensure organization ansibletestorg exists - infra.quay_configuration.quay_organization: - name: ansibletestorg - email: ansibletestorg@example.com - state: present - quay_host: "{{ quay_url }}" - quay_token: "{{ quay_token }}" - validate_certs: false - - name: Ensure non-existing proxy cache configuration is deleted (no change) infra.quay_configuration.quay_proxy_cache: organization: ansibletestorg @@ -90,14 +80,4 @@ ansible.builtin.assert: that: not result['changed'] fail_msg: The preceding task should not have changed anything - -- name: Ensure the organization is removed - infra.quay_configuration.quay_organization: - name: ansibletestorg - state: absent - quay_host: "{{ quay_url }}" - # For testing, authenticating with username/password instead of the token - quay_username: "{{ admin_username }}" - quay_password: "{{ admin_password }}" - validate_certs: false ... diff --git a/tests/integration/targets/quay_quota/meta/main.yml b/tests/integration/targets/quay_quota/meta/main.yml index e978127..6f61d07 100644 --- a/tests/integration/targets/quay_quota/meta/main.yml +++ b/tests/integration/targets/quay_quota/meta/main.yml @@ -1,4 +1,4 @@ --- dependencies: - - setup_token + - setup_organization ... diff --git a/tests/integration/targets/quay_quota/tasks/main.yml b/tests/integration/targets/quay_quota/tasks/main.yml index c271c58..8c35d46 100644 --- a/tests/integration/targets/quay_quota/tasks/main.yml +++ b/tests/integration/targets/quay_quota/tasks/main.yml @@ -1,14 +1,4 @@ --- -# Supporting organization -- name: Ensure organization ansibletestorg exists - infra.quay_configuration.quay_organization: - name: ansibletestorg - email: ansibletestorg@example.com - state: present - quay_host: "{{ quay_url }}" - quay_token: "{{ quay_token }}" - validate_certs: false - - name: Ensure quota exists but no quota/limits given (no change) infra.quay_configuration.quay_quota: organization: ansibletestorg @@ -191,14 +181,4 @@ ansible.builtin.assert: that: result['changed'] fail_msg: The preceding task should have changed something - -- name: Ensure the organization is removed - infra.quay_configuration.quay_organization: - name: ansibletestorg - state: absent - quay_host: "{{ quay_url }}" - # For testing, authenticating with username/password instead of the token - quay_username: "{{ admin_username }}" - quay_password: "{{ admin_password }}" - validate_certs: false ... diff --git a/tests/integration/targets/quay_repository/meta/main.yml b/tests/integration/targets/quay_repository/meta/main.yml index e978127..6f61d07 100644 --- a/tests/integration/targets/quay_repository/meta/main.yml +++ b/tests/integration/targets/quay_repository/meta/main.yml @@ -1,4 +1,4 @@ --- dependencies: - - setup_token + - setup_organization ... diff --git a/tests/integration/targets/quay_repository/tasks/main.yml b/tests/integration/targets/quay_repository/tasks/main.yml index 762e3e9..4103d1b 100644 --- a/tests/integration/targets/quay_repository/tasks/main.yml +++ b/tests/integration/targets/quay_repository/tasks/main.yml @@ -1,49 +1,4 @@ --- -# Supporting organization -- name: Ensure organization ansibletestorg exists - infra.quay_configuration.quay_organization: - name: ansibletestorg - email: ansibletestorg@example.com - state: present - quay_host: "{{ quay_url }}" - quay_token: "{{ quay_token }}" - validate_certs: false - -# Supporting user accounts -- name: Ensure user accounts exist - infra.quay_configuration.quay_user: - username: "{{ item }}" - email: "{{ item }}@example.com" - state: present - quay_host: "{{ quay_url }}" - quay_token: "{{ quay_token }}" - validate_certs: false - loop: - - ansibletestuser1 - - ansibletestuser2 - - ansibletestuser3 - - ansibletestuser5 - -# Supporting robot accounts -- name: Ensure the robot accounts exist - infra.quay_configuration.quay_robot: - name: ansibletestorg+ansibletestrobot1 - state: present - quay_host: "{{ quay_url }}" - quay_token: "{{ quay_token }}" - validate_certs: false - -# Supporting team -- name: Ensure teams exist - infra.quay_configuration.quay_team: - name: ansibletestteam1 - organization: ansibletestorg - role: admin - state: present - quay_host: "{{ quay_url }}" - quay_token: "{{ quay_token }}" - validate_certs: false - - name: Ensure repository ansibletestrepo1 exists infra.quay_configuration.quay_repository: name: ansibletestorg/ansibletestrepo1 @@ -132,7 +87,7 @@ visibility: public description: "In user namespace" perms: - - name: ansibletestuser5 + - name: ansibletestuser4 type: user role: admin state: present @@ -284,44 +239,4 @@ - ansibletestrepo2 - ansibletestrepo3 - ansibletestrepo4 - -- name: Ensure the teams are removed - infra.quay_configuration.quay_team: - name: ansibletestteam1 - organization: ansibletestorg - state: absent - quay_host: "{{ quay_url }}" - quay_token: "{{ quay_token }}" - validate_certs: false - -- name: Ensure user accounts are removed - infra.quay_configuration.quay_user: - username: "{{ item }}" - state: absent - quay_host: "{{ quay_url }}" - quay_token: "{{ quay_token }}" - validate_certs: false - loop: - - ansibletestuser1 - - ansibletestuser2 - - ansibletestuser3 - - ansibletestuser5 - -- name: Ensure the robot accounts are removed - infra.quay_configuration.quay_robot: - name: ansibletestorg+ansibletestrobot1 - state: absent - quay_host: "{{ quay_url }}" - quay_token: "{{ quay_token }}" - validate_certs: false - -- name: Ensure the organization is removed - infra.quay_configuration.quay_organization: - name: ansibletestorg - state: absent - quay_host: "{{ quay_url }}" - # For testing, authenticating with username/password instead of the token - quay_username: "{{ admin_username }}" - quay_password: "{{ admin_password }}" - validate_certs: false ... diff --git a/tests/integration/targets/quay_repository_mirror/meta/main.yml b/tests/integration/targets/quay_repository_mirror/meta/main.yml index e978127..6f61d07 100644 --- a/tests/integration/targets/quay_repository_mirror/meta/main.yml +++ b/tests/integration/targets/quay_repository_mirror/meta/main.yml @@ -1,4 +1,4 @@ --- dependencies: - - setup_token + - setup_organization ... diff --git a/tests/integration/targets/quay_repository_mirror/tasks/main.yml b/tests/integration/targets/quay_repository_mirror/tasks/main.yml index 2a2c7fe..0b9ce3c 100644 --- a/tests/integration/targets/quay_repository_mirror/tasks/main.yml +++ b/tests/integration/targets/quay_repository_mirror/tasks/main.yml @@ -1,23 +1,4 @@ --- -# Supporting organization -- name: Ensure organization ansibletestorg exists - infra.quay_configuration.quay_organization: - name: ansibletestorg - email: ansibletestorg@example.com - state: present - quay_host: "{{ quay_url }}" - quay_token: "{{ quay_token }}" - validate_certs: false - -# Supporting robot account -- name: Ensure the robot accounts exist - infra.quay_configuration.quay_robot: - name: ansibletestorg+ansibletestrobot1 - state: present - quay_host: "{{ quay_url }}" - quay_token: "{{ quay_token }}" - validate_certs: false - - name: Ensure repository ansibletestrepo1 exists infra.quay_configuration.quay_repository: name: ansibletestorg/ansibletestrepo1 @@ -125,22 +106,4 @@ quay_host: "{{ quay_url }}" quay_token: "{{ quay_token }}" validate_certs: false - -- name: Ensure the robot account is removed - infra.quay_configuration.quay_robot: - name: ansibletestorg+ansibletestrobot1 - state: absent - quay_host: "{{ quay_url }}" - quay_token: "{{ quay_token }}" - validate_certs: false - -- name: Ensure the organization is removed - infra.quay_configuration.quay_organization: - name: ansibletestorg - state: absent - quay_host: "{{ quay_url }}" - # For testing, authenticating with username/password instead of the token - quay_username: "{{ admin_username }}" - quay_password: "{{ admin_password }}" - validate_certs: false ... diff --git a/tests/integration/targets/quay_robot/meta/main.yml b/tests/integration/targets/quay_robot/meta/main.yml index e978127..6f61d07 100644 --- a/tests/integration/targets/quay_robot/meta/main.yml +++ b/tests/integration/targets/quay_robot/meta/main.yml @@ -1,4 +1,4 @@ --- dependencies: - - setup_token + - setup_organization ... diff --git a/tests/integration/targets/quay_robot/tasks/main.yml b/tests/integration/targets/quay_robot/tasks/main.yml index e495bb0..21c3611 100644 --- a/tests/integration/targets/quay_robot/tasks/main.yml +++ b/tests/integration/targets/quay_robot/tasks/main.yml @@ -1,26 +1,16 @@ --- -# Supporting organization -- name: Ensure organization ansibletestorg exists - infra.quay_configuration.quay_organization: - name: ansibletestorg - email: ansibletestorg@example.com - state: present - quay_host: "{{ quay_url }}" - quay_token: "{{ quay_token }}" - validate_certs: false - -- name: Ensure robot account ansibletestrobot1 exists +- name: Ensure robot account testrobot1 exists infra.quay_configuration.quay_robot: - name: ansibletestorg+ansibletestrobot1 + name: ansibletestorg+testrobot1 description: Test robot account in ansibletestorg state: present quay_host: "{{ quay_url }}" quay_token: "{{ quay_token }}" validate_certs: false -- name: Ensure robot account ansibletestrobot1 exists (no change) +- name: Ensure robot account testrobot1 exists (no change) infra.quay_configuration.quay_robot: - name: ansibletestorg+ansibletestrobot1 + name: ansibletestorg+testrobot1 state: present quay_host: "{{ quay_url }}" quay_token: "{{ quay_token }}" @@ -32,17 +22,17 @@ that: not result['changed'] fail_msg: The preceding task should not have changed anything -- name: Ensure robot account ansibletestrobot2 exists +- name: Ensure robot account testrobot2 exists infra.quay_configuration.quay_robot: - name: ansibletestorg+ansibletestrobot2 + name: ansibletestorg+testrobot2 state: present quay_host: "{{ quay_url }}" quay_token: "{{ quay_token }}" validate_certs: false -- name: Ensure robot account ansibletestrobot3 does not exist (no change) +- name: Ensure robot account testrobot3 does not exist (no change) infra.quay_configuration.quay_robot: - name: ansibletestorg+ansibletestrobot3 + name: ansibletestorg+testrobot3 state: absent quay_host: "{{ quay_url }}" quay_token: "{{ quay_token }}" @@ -54,18 +44,18 @@ that: not result['changed'] fail_msg: The preceding task should not have changed anything -- name: Ensure robot account ansibletestrobot4 exists in my namespace +- name: Ensure robot account testrobot4 exists in my namespace infra.quay_configuration.quay_robot: - name: ansibletestrobot4 + name: testrobot4 description: My robot state: present quay_host: "{{ quay_url }}" quay_token: "{{ quay_token }}" validate_certs: false -- name: Ensure robot account ansibletestrobot4 is removed from my namespace +- name: Ensure robot account testrobot4 is removed from my namespace infra.quay_configuration.quay_robot: - name: ansibletestrobot4 + name: testrobot4 description: My robot state: absent quay_host: "{{ quay_url }}" @@ -80,16 +70,6 @@ quay_token: "{{ quay_token }}" validate_certs: false loop: - - ansibletestorg+ansibletestrobot1 - - ansibletestorg+ansibletestrobot2 - -- name: Ensure the organization is removed - infra.quay_configuration.quay_organization: - name: ansibletestorg - state: absent - quay_host: "{{ quay_url }}" - # For testing, authenticating with username/password instead of the token - quay_username: "{{ admin_username }}" - quay_password: "{{ admin_password }}" - validate_certs: false + - ansibletestorg+testrobot1 + - ansibletestorg+testrobot2 ... diff --git a/tests/integration/targets/quay_tag/meta/main.yml b/tests/integration/targets/quay_tag/meta/main.yml index e978127..6f61d07 100644 --- a/tests/integration/targets/quay_tag/meta/main.yml +++ b/tests/integration/targets/quay_tag/meta/main.yml @@ -1,4 +1,4 @@ --- dependencies: - - setup_token + - setup_organization ... diff --git a/tests/integration/targets/quay_tag/tasks/main.yml b/tests/integration/targets/quay_tag/tasks/main.yml index 410f2b4..1610e21 100644 --- a/tests/integration/targets/quay_tag/tasks/main.yml +++ b/tests/integration/targets/quay_tag/tasks/main.yml @@ -1,14 +1,4 @@ --- -# Supporting organization -- name: Ensure organization ansibletestorg exists - infra.quay_configuration.quay_organization: - name: ansibletestorg - email: ansibletestorg@example.com - state: present - quay_host: "{{ quay_url }}" - quay_token: "{{ quay_token }}" - validate_certs: false - - name: Check whether podman is available ansible.builtin.command: cmd: podman --version @@ -263,13 +253,4 @@ quay_host: "{{ quay_url }}" quay_token: "{{ quay_token }}" validate_certs: false - -- name: Ensure the organization is removed - infra.quay_configuration.quay_organization: - name: ansibletestorg - state: absent - quay_host: "{{ quay_url }}" - # For testing, authenticating with username/password instead of the token - quay_username: "{{ admin_username }}" - quay_password: "{{ admin_password }}" - validate_certs: false +... diff --git a/tests/integration/targets/quay_tag_info/meta/main.yml b/tests/integration/targets/quay_tag_info/meta/main.yml index e978127..6f61d07 100644 --- a/tests/integration/targets/quay_tag_info/meta/main.yml +++ b/tests/integration/targets/quay_tag_info/meta/main.yml @@ -1,4 +1,4 @@ --- dependencies: - - setup_token + - setup_organization ... diff --git a/tests/integration/targets/quay_tag_info/tasks/main.yml b/tests/integration/targets/quay_tag_info/tasks/main.yml index a5f3185..4017f9d 100644 --- a/tests/integration/targets/quay_tag_info/tasks/main.yml +++ b/tests/integration/targets/quay_tag_info/tasks/main.yml @@ -1,14 +1,4 @@ --- -# Supporting organization -- name: Ensure organization ansibletestorg exists - infra.quay_configuration.quay_organization: - name: ansibletestorg - email: ansibletestorg@example.com - state: present - quay_host: "{{ quay_url }}" - quay_token: "{{ quay_token }}" - validate_certs: false - # Supporting repository - name: Ensure repository ansibletestrepo1 exists infra.quay_configuration.quay_repository: @@ -65,13 +55,4 @@ quay_host: "{{ quay_url }}" quay_token: "{{ quay_token }}" validate_certs: false - -- name: Ensure the organization is removed - infra.quay_configuration.quay_organization: - name: ansibletestorg - state: absent - quay_host: "{{ quay_url }}" - # For testing, authenticating with username/password instead of the token - quay_username: "{{ admin_username }}" - quay_password: "{{ admin_password }}" - validate_certs: false +... diff --git a/tests/integration/targets/quay_team/meta/main.yml b/tests/integration/targets/quay_team/meta/main.yml index e978127..6f61d07 100644 --- a/tests/integration/targets/quay_team/meta/main.yml +++ b/tests/integration/targets/quay_team/meta/main.yml @@ -1,4 +1,4 @@ --- dependencies: - - setup_token + - setup_organization ... diff --git a/tests/integration/targets/quay_team/tasks/main.yml b/tests/integration/targets/quay_team/tasks/main.yml index 1e86b19..dbf8672 100644 --- a/tests/integration/targets/quay_team/tasks/main.yml +++ b/tests/integration/targets/quay_team/tasks/main.yml @@ -1,53 +1,16 @@ --- -# Supporting organization -- name: Ensure organization ansibletestorg exists - infra.quay_configuration.quay_organization: - name: ansibletestorg - email: ansibletestorg@example.com - state: present - quay_host: "{{ quay_url }}" - quay_token: "{{ quay_token }}" - validate_certs: false - -# Supporting user accounts -- name: Ensure user accounts exist - infra.quay_configuration.quay_user: - username: "{{ item }}" - email: "{{ item }}@example.com" - state: present - quay_host: "{{ quay_url }}" - quay_token: "{{ quay_token }}" - validate_certs: false - loop: - - ansibletestuser1 - - ansibletestuser2 - - ansibletestuser3 - - ansibletestuser4 - -# Supporting robot accounts -- name: Ensure the robot accounts exist - infra.quay_configuration.quay_robot: - name: "{{ item }}" - state: present - quay_host: "{{ quay_url }}" - quay_token: "{{ quay_token }}" - validate_certs: false - loop: - - ansibletestorg+ansibletestrobot1 - - ansibletestorg+ansibletestrobot2 - -- name: Ensure team ansibletestteam1 exists +- name: Ensure team testteam1 exists infra.quay_configuration.quay_team: - name: ansibletestteam1 + name: testteam1 organization: ansibletestorg state: present quay_host: "{{ quay_url }}" quay_token: "{{ quay_token }}" validate_certs: false -- name: Ensure team ansibletestteam2 exists +- name: Ensure team testteam2 exists infra.quay_configuration.quay_team: - name: ansibletestteam2 + name: testteam2 organization: ansibletestorg description: | # Team 2 @@ -64,9 +27,9 @@ quay_token: "{{ quay_token }}" validate_certs: false -- name: Ensure team ansibletestteam2 is updated +- name: Ensure team testteam2 is updated infra.quay_configuration.quay_team: - name: ansibletestteam2 + name: testteam2 organization: ansibletestorg role: admin members: @@ -79,9 +42,9 @@ quay_token: "{{ quay_token }}" validate_certs: false -- name: Ensure team ansibletestteam2 has no members +- name: Ensure team testteam2 has no members infra.quay_configuration.quay_team: - name: ansibletestteam2 + name: testteam2 organization: ansibletestorg role: admin members: [] @@ -91,18 +54,18 @@ quay_token: "{{ quay_token }}" validate_certs: false -- name: Ensure team ansibletestteam3 exists +- name: Ensure team testteam3 exists infra.quay_configuration.quay_team: - name: ansibletestteam3 + name: testteam3 organization: ansibletestorg state: present quay_host: "{{ quay_url }}" quay_token: "{{ quay_token }}" validate_certs: false -- name: Ensure team ansibletestteam3 exists (no change) +- name: Ensure team testteam3 exists (no change) infra.quay_configuration.quay_team: - name: ansibletestteam3 + name: testteam3 organization: ansibletestorg role: member state: present @@ -140,41 +103,7 @@ quay_token: "{{ quay_token }}" validate_certs: false loop: - - ansibletestteam1 - - ansibletestteam2 - - ansibletestteam3 - -- name: Ensure user accounts are removed - infra.quay_configuration.quay_user: - username: "{{ item }}" - state: absent - quay_host: "{{ quay_url }}" - quay_token: "{{ quay_token }}" - validate_certs: false - loop: - - ansibletestuser1 - - ansibletestuser2 - - ansibletestuser3 - - ansibletestuser4 - -- name: Ensure the robot accounts are removed - infra.quay_configuration.quay_robot: - name: "{{ item }}" - state: absent - quay_host: "{{ quay_url }}" - quay_token: "{{ quay_token }}" - validate_certs: false - loop: - - ansibletestorg+ansibletestrobot1 - - ansibletestorg+ansibletestrobot2 - -- name: Ensure the organization is removed - infra.quay_configuration.quay_organization: - name: ansibletestorg - state: absent - quay_host: "{{ quay_url }}" - # For testing, authenticating with username/password instead of the token - quay_username: "{{ admin_username }}" - quay_password: "{{ admin_password }}" - validate_certs: false + - testteam1 + - testteam2 + - testteam3 ... diff --git a/tests/integration/targets/quay_team_ldap/meta/main.yml b/tests/integration/targets/quay_team_ldap/meta/main.yml index e978127..6f61d07 100644 --- a/tests/integration/targets/quay_team_ldap/meta/main.yml +++ b/tests/integration/targets/quay_team_ldap/meta/main.yml @@ -1,4 +1,4 @@ --- dependencies: - - setup_token + - setup_organization ... diff --git a/tests/integration/targets/quay_team_ldap/tasks/main.yml b/tests/integration/targets/quay_team_ldap/tasks/main.yml index eedea83..2dcb6c4 100644 --- a/tests/integration/targets/quay_team_ldap/tasks/main.yml +++ b/tests/integration/targets/quay_team_ldap/tasks/main.yml @@ -2,29 +2,10 @@ # Expecting user1, user2, user3, and user4 from LDAP # Expecting cn=group1,ou=users and cn=group2,ou=users from LDAP -# Supporting organization -- name: Ensure organization ansibletestorg exists - infra.quay_configuration.quay_organization: - name: ansibletestorg - email: ansibletestorg@example.com - state: present - quay_host: "{{ quay_url }}" - quay_token: "{{ quay_token }}" - validate_certs: false - -# Supporting robot account -- name: Ensure the robot account exists - infra.quay_configuration.quay_robot: - name: ansibletestorg+ansibletestrobot1 - state: present - quay_host: "{{ quay_url }}" - quay_token: "{{ quay_token }}" - validate_certs: false - # Supporting team -- name: Ensure team ansibletestteam1 exists +- name: Ensure team testteam1 exists infra.quay_configuration.quay_team: - name: ansibletestteam1 + name: testteam1 organization: ansibletestorg state: present role: creator @@ -34,9 +15,9 @@ quay_token: "{{ quay_token }}" validate_certs: false -- name: Ensure team ansibletestteam1 is not synchronized (no change) +- name: Ensure team testteam1 is not synchronized (no change) infra.quay_configuration.quay_team_ldap: - name: ansibletestteam1 + name: testteam1 organization: ansibletestorg sync: false quay_host: "{{ quay_url }}" @@ -49,9 +30,9 @@ that: not result['changed'] fail_msg: The preceding task should not have changed anything -- name: Ensure team ansibletestteam1 is synchronized (group1) +- name: Ensure team testteam1 is synchronized (group1) infra.quay_configuration.quay_team_ldap: - name: ansibletestteam1 + name: testteam1 organization: ansibletestorg sync: true group_dn: cn=group1,ou=users @@ -59,9 +40,9 @@ quay_token: "{{ quay_token }}" validate_certs: false -- name: Ensure team ansibletestteam1 is synchronized (no change) +- name: Ensure team testteam1 is synchronized (no change) infra.quay_configuration.quay_team_ldap: - name: ansibletestteam1 + name: testteam1 organization: ansibletestorg group_dn: cn=group1,ou=users quay_host: "{{ quay_url }}" @@ -74,9 +55,9 @@ that: not result['changed'] fail_msg: The preceding task should not have changed anything -- name: Ensure team ansibletestteam1 synchronization is updated (group2) +- name: Ensure team testteam1 synchronization is updated (group2) infra.quay_configuration.quay_team_ldap: - name: ansibletestteam1 + name: testteam1 organization: ansibletestorg sync: true group_dn: cn=group2,ou=users @@ -84,9 +65,9 @@ quay_token: "{{ quay_token }}" validate_certs: false -- name: Ensure team ansibletestteam1 is not synchronized anymore +- name: Ensure team testteam1 is not synchronized anymore infra.quay_configuration.quay_team_ldap: - name: ansibletestteam1 + name: testteam1 organization: ansibletestorg sync: false group_dn: cn=group1,ou=users @@ -95,9 +76,9 @@ quay_token: "{{ quay_token }}" validate_certs: false -- name: Ensure team ansibletestteam1 is not synchronized anymore (no change) +- name: Ensure team testteam1 is not synchronized anymore (no change) infra.quay_configuration.quay_team_ldap: - name: ansibletestteam1 + name: testteam1 organization: ansibletestorg sync: false quay_host: "{{ quay_url }}" @@ -110,30 +91,12 @@ that: not result['changed'] fail_msg: The preceding task should not have changed anything -- name: Ensure the ansibletestteam1 team is removed +- name: Ensure the testteam1 team is removed infra.quay_configuration.quay_team: - name: ansibletestteam1 + name: testteam1 organization: ansibletestorg state: absent quay_host: "{{ quay_url }}" quay_token: "{{ quay_token }}" validate_certs: false - -- name: Ensure the robot account is removed - infra.quay_configuration.quay_robot: - name: ansibletestorg+ansibletestrobot1 - state: absent - quay_host: "{{ quay_url }}" - quay_token: "{{ quay_token }}" - validate_certs: false - -- name: Ensure the organization is removed - infra.quay_configuration.quay_organization: - name: ansibletestorg - state: absent - quay_host: "{{ quay_url }}" - # For testing, authenticating with username/password instead of the token - quay_username: "{{ admin_username }}" - quay_password: "{{ admin_password }}" - validate_certs: false ... diff --git a/tests/integration/targets/quay_team_oidc/meta/main.yml b/tests/integration/targets/quay_team_oidc/meta/main.yml index e978127..6f61d07 100644 --- a/tests/integration/targets/quay_team_oidc/meta/main.yml +++ b/tests/integration/targets/quay_team_oidc/meta/main.yml @@ -1,4 +1,4 @@ --- dependencies: - - setup_token + - setup_organization ... diff --git a/tests/integration/targets/quay_team_oidc/tasks/main.yml b/tests/integration/targets/quay_team_oidc/tasks/main.yml index 6db46b0..5c87019 100644 --- a/tests/integration/targets/quay_team_oidc/tasks/main.yml +++ b/tests/integration/targets/quay_team_oidc/tasks/main.yml @@ -1,29 +1,10 @@ --- # Expecting group1 and group2 from OIDC -# Supporting organization -- name: Ensure organization ansibletestorg exists - infra.quay_configuration.quay_organization: - name: ansibletestorg - email: ansibletestorg@example.com - state: present - quay_host: "{{ quay_url }}" - quay_token: "{{ quay_token }}" - validate_certs: false - -# Supporting robot account -- name: Ensure the robot account exists - infra.quay_configuration.quay_robot: - name: ansibletestorg+ansibletestrobot1 - state: present - quay_host: "{{ quay_url }}" - quay_token: "{{ quay_token }}" - validate_certs: false - # Supporting team -- name: Ensure team ansibletestteam1 exists +- name: Ensure team testteam1 exists infra.quay_configuration.quay_team: - name: ansibletestteam1 + name: testteam1 organization: ansibletestorg state: present role: creator @@ -33,9 +14,9 @@ quay_token: "{{ quay_token }}" validate_certs: false -- name: Ensure team ansibletestteam1 is not synchronized (no change) +- name: Ensure team testteam1 is not synchronized (no change) infra.quay_configuration.quay_team_oidc: - name: ansibletestteam1 + name: testteam1 organization: ansibletestorg sync: false quay_host: "{{ quay_url }}" @@ -48,9 +29,9 @@ that: not result['changed'] fail_msg: The preceding task should not have changed anything -- name: Ensure team ansibletestteam1 is synchronized (group1) +- name: Ensure team testteam1 is synchronized (group1) infra.quay_configuration.quay_team_oidc: - name: ansibletestteam1 + name: testteam1 organization: ansibletestorg sync: true group_name: group1 @@ -58,9 +39,9 @@ quay_token: "{{ quay_token }}" validate_certs: false -- name: Ensure team ansibletestteam1 is synchronized (no change) +- name: Ensure team testteam1 is synchronized (no change) infra.quay_configuration.quay_team_oidc: - name: ansibletestteam1 + name: testteam1 organization: ansibletestorg group_name: group1 quay_host: "{{ quay_url }}" @@ -73,9 +54,9 @@ that: not result['changed'] fail_msg: The preceding task should not have changed anything -- name: Ensure team ansibletestteam1 synchronization is updated (group2) +- name: Ensure team testteam1 synchronization is updated (group2) infra.quay_configuration.quay_team_oidc: - name: ansibletestteam1 + name: testteam1 organization: ansibletestorg sync: true group_name: group2 @@ -83,9 +64,9 @@ quay_token: "{{ quay_token }}" validate_certs: false -- name: Ensure team ansibletestteam1 is not synchronized anymore +- name: Ensure team testteam1 is not synchronized anymore infra.quay_configuration.quay_team_oidc: - name: ansibletestteam1 + name: testteam1 organization: ansibletestorg sync: false group_name: group1 @@ -93,9 +74,9 @@ quay_token: "{{ quay_token }}" validate_certs: false -- name: Ensure team ansibletestteam1 is not synchronized anymore (no change) +- name: Ensure team testteam1 is not synchronized anymore (no change) infra.quay_configuration.quay_team_oidc: - name: ansibletestteam1 + name: testteam1 organization: ansibletestorg sync: false quay_host: "{{ quay_url }}" @@ -108,30 +89,12 @@ that: not result['changed'] fail_msg: The preceding task should not have changed anything -- name: Ensure the ansibletestteam1 team is removed +- name: Ensure the testteam1 team is removed infra.quay_configuration.quay_team: - name: ansibletestteam1 + name: testteam1 organization: ansibletestorg state: absent quay_host: "{{ quay_url }}" quay_token: "{{ quay_token }}" validate_certs: false - -- name: Ensure the robot account is removed - infra.quay_configuration.quay_robot: - name: ansibletestorg+ansibletestrobot1 - state: absent - quay_host: "{{ quay_url }}" - quay_token: "{{ quay_token }}" - validate_certs: false - -- name: Ensure the organization is removed - infra.quay_configuration.quay_organization: - name: ansibletestorg - state: absent - quay_host: "{{ quay_url }}" - # For testing, authenticating with username/password instead of the token - quay_username: "{{ admin_username }}" - quay_password: "{{ admin_password }}" - validate_certs: false ... diff --git a/tests/integration/targets/quay_vulnerability_info/tasks/main.yml b/tests/integration/targets/quay_vulnerability_info/tasks/main.yml index f21c576..8b869d8 100644 --- a/tests/integration/targets/quay_vulnerability_info/tasks/main.yml +++ b/tests/integration/targets/quay_vulnerability_info/tasks/main.yml @@ -44,3 +44,4 @@ ansible.builtin.assert: that: vulns['vulnerabilities']|length == 0 fail_msg: The preceding task should not have returned vulnerabilities +... diff --git a/tests/integration/targets/role_quay_org/tasks/main.yml b/tests/integration/targets/role_quay_org/tasks/main.yml index a9be1bc..0d99aa2 100644 --- a/tests/integration/targets/role_quay_org/tasks/main.yml +++ b/tests/integration/targets/role_quay_org/tasks/main.yml @@ -6,8 +6,8 @@ quay_org_host: "{{ quay_url }}" quay_org_token: "{{ quay_token }}" quay_org_validate_certs: false - quay_org_name: ansibletestorg - quay_org_email: ansibletestorg@example.com + quay_org_name: testorg + quay_org_email: testorg@example.com quay_org_auto_prune_method: tags quay_org_auto_prune_value: 15 quay_org_cache_registry: public.ecr.aws/nginx @@ -17,70 +17,70 @@ quay_org_warning_pct: 90 quay_org_reject_pct: 97 quay_org_users: - - username: ansibletestuser1 - email: ansibletestuser1@example.com + - username: testuser1 + email: testuser1@example.com password: vs9mrD55NP - - username: ansibletestuser2 - email: ansibletestuser2@example.com - - username: ansibletestuser3 - email: ansibletestuser3@example.com + - username: testuser2 + email: testuser2@example.com + - username: testuser3 + email: testuser3@example.com quay_org_robots: - - name: ansibletestrobot1 + - name: testrobot1 description: Test robot 1 quay_org_teams: - - name: ansibletestteam1 + - name: testteam1 description: Test team 1 role: member members: - - ansibletestuser1 - - name: ansibletestteam2 + - testuser1 + - name: testteam2 role: creator members: - - ansibletestuser2 - - ansibletestorg+ansibletestrobot1 + - testuser2 + - testorg+testrobot1 quay_org_default_perms: - - name: ansibletestteam2 + - name: testteam2 type: team role: write - - name: ansibletestuser1 + - name: testuser1 type: user role: read - creator: ansibletestuser3 + creator: testuser3 quay_org_applications: - - name: ansibletestapp1 + - name: testapp1 description: Test application 1 - - name: ansibletestapp2 + - name: testapp2 application_uri: http://test.example.com redirect_uri: http://test.example.com avatar_email: http://test.example.com quay_org_repositories: - - name: ansibletestrepo1 + - name: testrepo1 description: Test repository 1 visibility: public auto_prune_method: date auto_prune_value: 10w perms: - - name: ansibletestteam1 + - name: testteam1 type: team role: read - - name: ansibletestrepo2 + - name: testrepo2 # Cleanup (by using quay_username and quay_password for testing purpose) - name: Ensure repositories are removed infra.quay_configuration.quay_repository: - name: "ansibletestorg/{{ item }}" + name: "testorg/{{ item }}" state: absent quay_host: "{{ quay_url }}" quay_username: "{{ admin_username }}" quay_password: "{{ admin_password }}" validate_certs: false loop: - - ansibletestrepo1 - - ansibletestrepo2 + - testrepo1 + - testrepo2 - name: Ensure the applications are removed infra.quay_configuration.quay_application: - organization: ansibletestorg + organization: testorg name: "{{ item }}" state: absent quay_host: "{{ quay_url }}" @@ -88,25 +88,25 @@ quay_password: "{{ admin_password }}" validate_certs: false loop: - - ansibletestapp1 - - ansibletestapp2 + - testapp1 + - testapp2 - name: Ensure the teams are removed infra.quay_configuration.quay_team: name: "{{ item }}" - organization: ansibletestorg + organization: testorg state: absent quay_host: "{{ quay_url }}" quay_username: "{{ admin_username }}" quay_password: "{{ admin_password }}" validate_certs: false loop: - - ansibletestteam1 - - ansibletestteam2 + - testteam1 + - testteam2 - name: Ensure the robot accounts are removed infra.quay_configuration.quay_robot: - name: ansibletestorg+ansibletestrobot1 + name: testorg+testrobot1 state: absent quay_host: "{{ quay_url }}" quay_username: "{{ admin_username }}" @@ -122,13 +122,13 @@ quay_password: "{{ admin_password }}" validate_certs: false loop: - - ansibletestuser1 - - ansibletestuser2 - - ansibletestuser3 + - testuser1 + - testuser2 + - testuser3 - name: Ensure the proxy cache configuration is removed infra.quay_configuration.quay_proxy_cache: - organization: ansibletestorg + organization: testorg state: absent quay_host: "{{ quay_url }}" quay_username: "{{ admin_username }}" @@ -137,9 +137,10 @@ - name: Ensure the organization is removed infra.quay_configuration.quay_organization: - name: ansibletestorg + name: testorg state: absent quay_host: "{{ quay_url }}" quay_username: "{{ admin_username }}" quay_password: "{{ admin_password }}" validate_certs: false +... diff --git a/tests/integration/targets/setup_organization/handlers/main.yml b/tests/integration/targets/setup_organization/handlers/main.yml new file mode 100644 index 0000000..3474697 --- /dev/null +++ b/tests/integration/targets/setup_organization/handlers/main.yml @@ -0,0 +1,45 @@ +--- +# Supporting user accounts +- name: Ensure user accounts exist + infra.quay_configuration.quay_user: + username: "{{ item }}" + email: "{{ item }}@example.com" + state: present + quay_host: "{{ quay_url }}" + quay_token: "{{ quay_token }}" + validate_certs: false + loop: + - ansibletestuser1 + - ansibletestuser2 + - ansibletestuser3 + - ansibletestuser4 + listen: Create resources in organization + +# Supporting robot accounts +- name: Ensure the robot accounts exist + infra.quay_configuration.quay_robot: + name: "{{ item }}" + state: present + quay_host: "{{ quay_url }}" + quay_token: "{{ quay_token }}" + validate_certs: false + loop: + - ansibletestorg+ansibletestrobot1 + - ansibletestorg+ansibletestrobot2 + listen: Create resources in organization + +# Supporting teams +- name: Ensure teams exist + infra.quay_configuration.quay_team: + name: "{{ item }}" + organization: ansibletestorg + role: admin + state: present + quay_host: "{{ quay_url }}" + quay_token: "{{ quay_token }}" + validate_certs: false + loop: + - ansibletestteam1 + - ansibletestteam2 + listen: Create resources in organization +... diff --git a/tests/integration/targets/setup_organization/meta/main.yml b/tests/integration/targets/setup_organization/meta/main.yml new file mode 100644 index 0000000..e978127 --- /dev/null +++ b/tests/integration/targets/setup_organization/meta/main.yml @@ -0,0 +1,4 @@ +--- +dependencies: + - setup_token +... diff --git a/tests/integration/targets/setup_organization/tasks/main.yml b/tests/integration/targets/setup_organization/tasks/main.yml new file mode 100644 index 0000000..79dc236 --- /dev/null +++ b/tests/integration/targets/setup_organization/tasks/main.yml @@ -0,0 +1,14 @@ +--- +# Supporting organization +- name: Ensure organization ansibletestorg exists + infra.quay_configuration.quay_organization: + name: ansibletestorg + email: ansibletestorg@example.com + state: present + quay_host: "{{ quay_url }}" + quay_token: "{{ quay_token }}" + validate_certs: false + # To speed up the tests, only create the user accounts, robots, and teams + # when the organization does not already exist. + notify: Create resources in organization +...