diff --git a/.github/workflows/ci_automation_hub_collection.yml b/.github/workflows/ci_automation_hub_collection.yml index eb6a1dcf1a..03b80657f5 100644 --- a/.github/workflows/ci_automation_hub_collection.yml +++ b/.github/workflows/ci_automation_hub_collection.yml @@ -33,22 +33,25 @@ jobs: - name: install ansible run: pip3 install ansible - - name: Checkout the galaxy collection + - name: Checkout the ansible_hub collection uses: actions/checkout@v4 with: - repository: ansible/galaxy_collection - path: galaxy_collection + repository: ansible-collections/ansible_hub + path: ansible_hub + + - name: copy galaxy.yml.j2 to ansible_hub + run: | + cp dev/galaxy_collection_plays/galaxy.yml.j2 ansible_hub - name: Build and install the collection - working-directory: galaxy_collection + working-directory: ansible_hub run: | # The ansible.cfg defined in the collection repository might break the test. We want the same variables for installation and running. rm -f ansible.cfg rm -f galaxy.yml - mv .github/files/galaxy.yml.j2 . - ansible all -i localhost, -c local -m template -a "src=galaxy.yml.j2 dest=galaxy.yml" -e collection_namespace=galaxy -e collection_name=galaxy -e collection_version=1.0.0 -e collection_repo=https://github.com/ansible/automation_hub_collection + ansible all -i localhost, -c local -m template -a "src=galaxy.yml.j2 dest=galaxy.yml" -e collection_namespace=ansible -e collection_name=hub -e collection_version=1.0.0 -e collection_repo=https://github.com/ansible-collections/ansible_hub ansible-galaxy collection build -vvv - ansible-galaxy collection install galaxy-galaxy-1.0.0.tar.gz -vvv + ansible-galaxy collection install ansible-hub-1.0.0.tar.gz -vvv #- name: Spin up a standalone galaxy_ng installation # run: | diff --git a/dev/galaxy_collection_plays/content.yml b/dev/galaxy_collection_plays/content.yml index c181df1ff4..f2da25dd25 100644 --- a/dev/galaxy_collection_plays/content.yml +++ b/dev/galaxy_collection_plays/content.yml @@ -4,7 +4,7 @@ connection: local gather_facts: false collections: - - galaxy.galaxy + - ansible.hub pre_tasks: - name: Include variables @@ -12,80 +12,71 @@ file: vars.yml tasks: - - name: Authenticate and retrieve API token - ah_token: - ah_host: "{{ ah_host }}" - ah_username: "{{ ah_username }}" - ah_password: "{{ ah_password }}" - ah_path_prefix: "{{ ah_path_prefix }}" - - name: Create the automate namespace - ah_namespace: + ansible.hub.ah_namespace: name: automate company: Automator Inc. email: automator@redhat.com description: The namespace for all things automation ah_host: "{{ ah_host }}" - ah_token: "{{ ah_token }}" - ah_path_prefix: "{{ ah_path_prefix }}" + ah_username: "{{ ah_username }}" + ah_password: "{{ ah_password }}" + validate_certs: "{{ ah_validate_certs }}" - name: Rename automate namespace to automator - ah_namespace: + ansible.hub.ah_namespace: name: automate new_name: automator ah_host: "{{ ah_host }}" - ah_token: "{{ ah_token }}" - ah_path_prefix: "{{ ah_path_prefix }}" + ah_username: "{{ ah_username }}" + ah_password: "{{ ah_password }}" + validate_certs: "{{ ah_validate_certs }}" - name: Delete the automator namespace - ah_namespace: + ansible.hub.ah_namespace: state: absent name: automator ah_host: "{{ ah_host }}" - ah_token: "{{ ah_token }}" - ah_path_prefix: "{{ ah_path_prefix }}" + ah_username: "{{ ah_username }}" + ah_password: "{{ ah_password }}" + validate_certs: "{{ ah_validate_certs }}" - - name: Ensure there is a galaxy namespace - ah_namespace: - name: galaxy + - name: Ensure there is a ansible namespace + ansible.hub.ah_namespace: + name: ansible ah_host: "{{ ah_host }}" - ah_token: "{{ ah_token }}" - ah_path_prefix: "{{ ah_path_prefix }}" + ah_username: "{{ ah_username }}" + ah_password: "{{ ah_password }}" + validate_certs: "{{ ah_validate_certs }}" + state: present - - name: Upload the galaxy collection to the galaxy namespace - ah_collection: - namespace: galaxy - name: galaxy + - name: Upload the ansible hub collection to the ansible namespace + ansible.hub.ah_collection_upload: path: "{{ ah_artifact_runner_absolute_path }}" - version: "1.0.0" ah_host: "{{ ah_host }}" - ah_token: "{{ ah_token }}" - ah_path_prefix: "{{ ah_path_prefix }}" + ah_username: "{{ ah_username }}" + ah_password: "{{ ah_password }}" + validate_certs: "{{ ah_validate_certs }}" - - name: Approve the galaxy collection - ah_approval: - namespace: galaxy - name: galaxy + - name: Approve the ansible hub collection + ansible.hub.ah_approval: + namespace: ansible + name: hub version: "1.0.0" ah_host: "{{ ah_host }}" - ah_token: "{{ ah_token }}" - ah_path_prefix: "{{ ah_path_prefix }}" + ah_username: "{{ ah_username }}" + ah_password: "{{ ah_password }}" + validate_certs: "{{ ah_validate_certs }}" async: 600 poll: 10 - - name: Delete the galaxy collection - ah_collection: + - name: Delete the ansible hub collection + ansible.hub.ah_collection: state: absent - namespace: galaxy - name: galaxy + namespace: ansible + name: hub version: "1.0.0" ah_host: "{{ ah_host }}" - ah_token: "{{ ah_token }}" - ah_path_prefix: "{{ ah_path_prefix }}" - - - name: Deauthenticate - ah_token: - state: absent - ah_host: "{{ ah_host }}" - ah_token: "{{ ah_token }}" - ah_path_prefix: "{{ ah_path_prefix }}" + ah_username: "{{ ah_username }}" + ah_password: "{{ ah_password }}" + validate_certs: "{{ ah_validate_certs }}" diff --git a/dev/galaxy_collection_plays/ee.yml b/dev/galaxy_collection_plays/ee.yml index 2c10d0279a..ddb80c5078 100644 --- a/dev/galaxy_collection_plays/ee.yml +++ b/dev/galaxy_collection_plays/ee.yml @@ -4,7 +4,7 @@ connection: local gather_facts: false collections: - - galaxy.galaxy + - ansible.hub pre_tasks: - name: Include variables @@ -13,13 +13,13 @@ tasks: - name: Add redhat.io registry - ah_ee_registry: + ansible.hub.ah_ee_registry: name: redhat url: registry.redhat.io ah_host: "{{ ah_host }}" ah_username: "{{ ah_username }}" ah_password: "{{ ah_password }}" - ah_path_prefix: "{{ ah_path_prefix }}" + validate_certs: "{{ ah_validate_certs }}" # Can be uncommented after AAH-2607 is resolved. # @@ -53,10 +53,10 @@ # ah_path_prefix: "{{ ah_path_prefix }}" - name: Delete the redhat.io registry - ah_ee_registry: + ansible.hub.ah_ee_registry: name: redhat state: absent ah_host: "{{ ah_host }}" ah_username: "{{ ah_username }}" ah_password: "{{ ah_password }}" - ah_path_prefix: "{{ ah_path_prefix }}" + validate_certs: "{{ ah_validate_certs }}" diff --git a/dev/galaxy_collection_plays/galaxy.yml.j2 b/dev/galaxy_collection_plays/galaxy.yml.j2 new file mode 100644 index 0000000000..864cebb502 --- /dev/null +++ b/dev/galaxy_collection_plays/galaxy.yml.j2 @@ -0,0 +1,30 @@ +--- +authors: + - Sean Sullivan @sean-m-sullivan + - Tom Page @Tompage1994 + - David Danielsson @djdanielsson +dependencies: {} +description: Ansible content that interacts with the Ansible Automation Hub or Galaxy NG API. +documentation: https://github.com/redhat-cop/ah_configuration/blob/master/README.md +license: + - GPL-3.0-only +namespace: {{ collection_namespace }} +name: {{ collection_name }} +version: {{ collection_version }} +readme: README.md +repository: {{ collection_repo }} +issues: {{ collection_repo }}/issues +tags: + - cloud + - infrastructure + - galaxy + - ansible + - galaxy + - automation +build_ignore: + - tools + - setup.cfg + - galaxy.yml.j2 + - template_galaxy.yml + - '*.tar.gz' +... diff --git a/dev/galaxy_collection_plays/repo.yml b/dev/galaxy_collection_plays/repo.yml index 0768b37f70..c7c5571f96 100644 --- a/dev/galaxy_collection_plays/repo.yml +++ b/dev/galaxy_collection_plays/repo.yml @@ -4,7 +4,7 @@ connection: local gather_facts: false collections: - - galaxy.galaxy + - ansible.hub pre_tasks: - name: Include variables @@ -12,33 +12,23 @@ file: vars.yml tasks: - - name: Authenticate and retrieve API token - ah_token: - ah_host: "{{ ah_host }}" - ah_username: "{{ ah_username }}" - ah_password: "{{ ah_password }}" - ah_path_prefix: "{{ ah_path_prefix }}" - - name: Configure community repository - ah_repository: + ansible.hub.collection_remote: name: community url: https://galaxy.ansible.com/api/ requirements: - community.docker - geerlingguy.k8s ah_host: "{{ ah_host }}" - ah_token: "{{ ah_token }}" - ah_path_prefix: "{{ ah_path_prefix }}" + ah_username: "{{ ah_username }}" + ah_password: "{{ ah_password }}" + validate_certs: "{{ ah_validate_certs }}" - name: Sync community repository - ah_repository_sync: + ansible.hub.collection_repository_sync: name: community + wait: false ah_host: "{{ ah_host }}" - ah_token: "{{ ah_token }}" - ah_path_prefix: "{{ ah_path_prefix }}" - - - name: Deauthenticate - ah_token: - ah_host: "{{ ah_host }}" - ah_token: "{{ ah_token }}" - ah_path_prefix: "{{ ah_path_prefix }}" + ah_username: "{{ ah_username }}" + ah_password: "{{ ah_password }}" + validate_certs: "{{ ah_validate_certs }}" diff --git a/dev/galaxy_collection_plays/user.yml b/dev/galaxy_collection_plays/user.yml index 10d1748d99..c99c164d00 100644 --- a/dev/galaxy_collection_plays/user.yml +++ b/dev/galaxy_collection_plays/user.yml @@ -4,7 +4,7 @@ connection: local gather_facts: false collections: - - galaxy.galaxy + - ansible.hub pre_tasks: - name: Include variables @@ -13,15 +13,15 @@ tasks: - name: Create a developers group - ah_group: + ansible.hub.ah_group: name: developers ah_host: "{{ ah_host }}" ah_username: "{{ ah_username }}" ah_password: "{{ ah_password }}" - ah_path_prefix: "{{ ah_path_prefix }}" + validate_certs: "{{ ah_validate_certs }}" - name: Add 3 new users who are developers - ah_user: + ansible.hub.ah_user: username: "dev_{{ item }}" password: password!@3w6$% first_name: Developer @@ -31,35 +31,35 @@ ah_host: "{{ ah_host }}" ah_username: "{{ ah_username }}" ah_password: "{{ ah_password }}" - ah_path_prefix: "{{ ah_path_prefix }}" + validate_certs: "{{ ah_validate_certs }}" loop: - red - green - blue - name: Create an executives group - ah_group: + ansible.hub.ah_group: name: executives ah_host: "{{ ah_host }}" ah_username: "{{ ah_username }}" ah_password: "{{ ah_password }}" - ah_path_prefix: "{{ ah_path_prefix }}" + validate_certs: "{{ ah_validate_certs }}" - name: Create an omnipotent role with all permissions - ah_role: + ansible.hub.ah_role: name: galaxy.omnipotent description: Manage anything and everything perms: all ah_host: "{{ ah_host }}" ah_username: "{{ ah_username }}" ah_password: "{{ ah_password }}" - ah_path_prefix: "{{ ah_path_prefix }}" + validate_certs: "{{ ah_validate_certs }}" # TODO: Add a test that permissions/roles can be added to a group after # https://github.com/ansible/galaxy_collection/issues/179 is resolved. - name: Create new executive users - ah_user: + ansible.hub.ah_user: username: "{{ item }}" password: executive!@3w6$% is_superuser: true @@ -70,38 +70,38 @@ ah_host: "{{ ah_host }}" ah_username: "{{ ah_username }}" ah_password: "{{ ah_password }}" - ah_path_prefix: "{{ ah_path_prefix }}" + validate_certs: "{{ ah_validate_certs }}" loop: - ceo - cfo - cto - name: Delete the red developer - ah_user: + ansible.hub.ah_user: state: absent username: dev_red ah_host: "{{ ah_host }}" ah_username: "{{ ah_username }}" ah_password: "{{ ah_password }}" - ah_path_prefix: "{{ ah_path_prefix }}" + validate_certs: "{{ ah_validate_certs }}" - name: Delete the developers and executives groups - ah_group: + ansible.hub.ah_group: state: absent name: "{{ item }}" ah_host: "{{ ah_host }}" ah_username: "{{ ah_username }}" ah_password: "{{ ah_password }}" - ah_path_prefix: "{{ ah_path_prefix }}" + validate_certs: "{{ ah_validate_certs }}" loop: - developers - executives - name: Delete the omnipotent role - ah_role: + ansible.hub.ah_role: state: absent name: galaxy.omnipotent ah_host: "{{ ah_host }}" ah_username: "{{ ah_username }}" ah_password: "{{ ah_password }}" - ah_path_prefix: "{{ ah_path_prefix }}" + validate_certs: "{{ ah_validate_certs }}" diff --git a/dev/galaxy_collection_plays/vars.yml b/dev/galaxy_collection_plays/vars.yml index 8b5359f67b..ad42192f0f 100644 --- a/dev/galaxy_collection_plays/vars.yml +++ b/dev/galaxy_collection_plays/vars.yml @@ -1,5 +1,5 @@ ah_host: http://localhost:55001 -ah_username: iqe_admin -ah_password: redhat -ah_path_prefix: galaxy -ah_artifact_runner_absolute_path: /home/runner/work/galaxy_ng/galaxy_ng/galaxy_collection/galaxy-galaxy-1.0.0.tar.gz +ah_username: "iqe_admin" +ah_password: "redhat" +ah_validate_certs: "false" +ah_artifact_runner_absolute_path: /home/runner/work/galaxy_ng/galaxy_ng/ansible_hub/ansible-hub-1.0.0.tar.gz