redhat-cop / aap_utilities

Ansible Collection for automated deployment of AAP and other objects for general use
https://galaxy.ansible.com/infra/aap_utilities
GNU General Public License v3.0
74 stars 44 forks source link

Update __aap_setup_down_images filter #162

Closed philthynz closed 1 year ago

philthynz commented 1 year ago

Extending the filter to 3 so it covers AAP 2.3. The list between 2.2 and 2.3 are different.

What does this PR do?

The PR fixes https://github.com/redhat-cop/aap_utilities/issues/161 where downloading AAP 2.3 did not work for RHEL 8 or 9. The __aap_setup_down_images fact is different between the binaries for 2.2. and 2.3. I have just extedned the filter to [3] so it covers version 2.3.

How should this be tested?

The role can be tested from a playbook directly. One must include the aap_setup_download location in ansible.cfg and use export ANSIBLE_CONFIG=ansible.cfg to setup the environment acordingly. Example playbook:

- name: AAP Install
  hosts: localhost
  become: true
  gather_facts: false

  tasks:
    - include_role:
        name: aap_setup_download

Is there a relevant Issue open for this?

Resolves #161

Other Relevant info, PRs, etc

I have tested this locally for versions 2.2 and 2.3 Both the setup and setup-bundle downloads:

Setup 2.2

PLAY [AAP Install] ***********************************************************************************************************************************************************************
TASK [include_role : aap_setup_download] *************************************************************************************************************************************************
TASK [aap_setup_download : Login to Red Hat APIs] ****************************************************************************************************************************************ok: [localhost]

TASK [aap_setup_download : Collecting the available installers] **************************************************************************************************************************ok: [localhost]

TASK [aap_setup_download : Simplify the list of possible downloads] **********************************************************************************************************************ok: [localhost]

TASK [aap_setup_download : Downloading the latest installer of type setup] ***************************************************************************************************************skipping: [localhost] => (item={'imageName': 'Ansible Automation Platform 2.2.2 Setup Bundle', 'filename': 'ansible-automation-platform-setup-bundle-2.2.2-1.tar.gz', 'arch': 'x86_64', 'datePublished': '2023-03-09T18:13:40.000Z', 'checksum': 'a93c4133158150c2d542009112a6876741f42d069e5776ba1946e6cbb028593c', 'downloadHref': 'https://api.access.redhat.com/management/v1/images/a93c4133158150c2d542009112a6876741f42d069e5776ba1946e6cbb028593c/download'})
ok: [localhost] => (item={'imageName': 'Ansible Automation Platform 2.2.2 Setup', 'filename': 'ansible-automation-platform-setup-2.2.2-1.tar.gz', 'arch': 'x86_64', 'datePublished': '2023-03-09T18:13:39.000Z', 'checksum': '56adc8cc40e82568317237a63571ac857d9662b6c649fcc5a54cf7958f09a9a8', 'downloadHref': 'https://api.access.redhat.com/management/v1/images/56adc8cc40e82568317237a63571ac857d9662b6c649fcc5a54cf7958f09a9a8/download'})
ok: [localhost] => (item={'imageName': 'Ansible Automation Platform 2.2.1 Setup', 'filename': 'ansible-automation-platform-setup-2.2.1-3.tar.gz', 'arch': 'x86_64', 'datePublished': '2023-01-23T14:47:58.000Z', 'checksum': '902d4afa5b4160469d8f00b87d27fb289c22be459219ab9bea55b599ca4e03ae', 'downloadHref': 'https://api.access.redhat.com/management/v1/images/902d4afa5b4160469d8f00b87d27fb289c22be459219ab9bea55b599ca4e03ae/download'})

TASK [aap_setup_download : Extract the name of the downloaded installer to aap_setup_down_installer_file] ********************************************************************************ok: [localhost]

TASK [aap_setup_download : debug] ********************************************************************************************************************************************************ok: [localhost] => {
    "aap_setup_down_installer_file": "/var/tmp/ansible-automation-platform-setup-2.2.2-1.tar.gz"
}

Setup 2.3

PLAY [AAP Install] ***********************************************************************************************************************************************************************
TASK [include_role : aap_setup_download] *************************************************************************************************************************************************
TASK [aap_setup_download : Login to Red Hat APIs] ****************************************************************************************************************************************ok: [localhost]

TASK [aap_setup_download : Collecting the available installers] **************************************************************************************************************************ok: [localhost]

TASK [aap_setup_download : Simplify the list of possible downloads] **********************************************************************************************************************ok: [localhost]

TASK [aap_setup_download : Downloading the latest installer of type setup] ***************************************************************************************************************skipping: [localhost] => (item={'imageName': 'Ansible Automation Platform 2.3 Setup Bundle', 'filename': 'ansible-automation-platform-setup-bundle-2.3-2.1.tar.gz', 'arch': 'x86_64', 'datePublished': '2023-04-20T18:56:00.000Z', 'checksum': '7456b98f2f50e0e1d4c93fb4e375fe8a9174f397a5b1c0950915224f7f020ec4', 'downloadHref': 'https://api.access.redhat.com/management/v1/images/7456b98f2f50e0e1d4c93fb4e375fe8a9174f397a5b1c0950915224f7f020ec4/download'})
skipping: [localhost] => (item={'imageName': 'Ansible Validated Content', 'filename': 'ansible-validated-content-bundle-1.1.tar.gz', 'arch': 'x86_64', 'datePublished': '2023-04-04T15:59:28.000Z', 'checksum': 'c0d2eb18e7a87c77f5660b41ce8dc85e5e64841e95986a553ae90edecdc30f0c', 'downloadHref': 'https://api.access.redhat.com/management/v1/images/c0d2eb18e7a87c77f5660b41ce8dc85e5e64841e95986a553ae90edecdc30f0c/download'})
ok: [localhost] => (item={'imageName': 'Ansible Automation Platform 2.3 Setup', 'filename': 'ansible-automation-platform-setup-2.3-2.tar.gz', 'arch': 'x86_64', 'datePublished': '2023-03-16T13:00:52.000Z', 'checksum': '879e97e4c63de3727657284eb05a3a9e9897c66bd5059183d804d20f579c75a0', 'downloadHref': 'https://api.access.redhat.com/management/v1/images/879e97e4c63de3727657284eb05a3a9e9897c66bd5059183d804d20f579c75a0/download'})

TASK [aap_setup_download : Extract the name of the downloaded installer to aap_setup_down_installer_file] ********************************************************************************ok: [localhost]

TASK [aap_setup_download : debug] ********************************************************************************************************************************************************ok: [localhost] => {
    "aap_setup_down_installer_file": "/var/tmp/ansible-automation-platform-setup-2.3-2.tar.gz"
}

Setup Bundle 2.2

PLAY [AAP Install] ***********************************************************************************************************************************************************************

TASK [include_role : aap_setup_download] *************************************************************************************************************************************************

TASK [aap_setup_download : Login to Red Hat APIs] ****************************************************************************************************************************************ok: [localhost]

TASK [aap_setup_download : Collecting the available installers] **************************************************************************************************************************ok: [localhost]

TASK [aap_setup_download : Simplify the list of possible downloads] **********************************************************************************************************************ok: [localhost]

TASK [aap_setup_download : Downloading the latest installer of type setup-bundle] ********************************************************************************************************ok: [localhost] => (item={'imageName': 'Ansible Automation Platform 2.2.2 Setup Bundle', 'filename': 'ansible-automation-platform-setup-bundle-2.2.2-1.tar.gz', 'arch': 'x86_64', 'datePublished': '2023-03-09T18:13:40.000Z', 'checksum': 'a93c4133158150c2d542009112a6876741f42d069e5776ba1946e6cbb028593c', 'downloadHref': 'https://api.access.redhat.com/management/v1/images/a93c4133158150c2d542009112a6876741f42d069e5776ba1946e6cbb028593c/download'})
skipping: [localhost] => (item={'imageName': 'Ansible Automation Platform 2.2.2 Setup', 'filename': 'ansible-automation-platform-setup-2.2.2-1.tar.gz', 'arch': 'x86_64', 'datePublished': '2023-03-09T18:13:39.000Z', 'checksum': '56adc8cc40e82568317237a63571ac857d9662b6c649fcc5a54cf7958f09a9a8', 'downloadHref': 'https://api.access.redhat.com/management/v1/images/56adc8cc40e82568317237a63571ac857d9662b6c649fcc5a54cf7958f09a9a8/download'})
skipping: [localhost] => (item={'imageName': 'Ansible Automation Platform 2.2.1 Setup', 'filename': 'ansible-automation-platform-setup-2.2.1-3.tar.gz', 'arch': 'x86_64', 'datePublished': '2023-01-23T14:47:58.000Z', 'checksum': '902d4afa5b4160469d8f00b87d27fb289c22be459219ab9bea55b599ca4e03ae', 'downloadHref': 'https://api.access.redhat.com/management/v1/images/902d4afa5b4160469d8f00b87d27fb289c22be459219ab9bea55b599ca4e03ae/download'})

TASK [aap_setup_download : Extract the name of the downloaded installer to aap_setup_down_installer_file] ********************************************************************************ok: [localhost]

TASK [aap_setup_download : debug] ********************************************************************************************************************************************************ok: [localhost] => {
    "aap_setup_down_installer_file": "/var/tmp/ansible-automation-platform-setup-bundle-2.2.2-1.tar.gz"
}

Setup Bundle 2.3

PLAY [AAP Install] ***********************************************************************************************************************************************************************

TASK [include_role : aap_setup_download] *************************************************************************************************************************************************

TASK [aap_setup_download : Login to Red Hat APIs] ****************************************************************************************************************************************ok: [localhost]

TASK [aap_setup_download : Collecting the available installers] **************************************************************************************************************************ok: [localhost]

TASK [aap_setup_download : Simplify the list of possible downloads] **********************************************************************************************************************ok: [localhost]

TASK [aap_setup_download : Downloading the latest installer of type setup-bundle] ********************************************************************************************************changed: [localhost] => (item={'imageName': 'Ansible Automation Platform 2.3 Setup Bundle', 'filename': 'ansible-automation-platform-setup-bundle-2.3-2.1.tar.gz', 'arch': 'x86_64', 'datePublished': '2023-04-20T18:56:00.000Z', 'checksum': '7456b98f2f50e0e1d4c93fb4e375fe8a9174f397a5b1c0950915224f7f020ec4', 'downloadHref': 'https://api.access.redhat.com/management/v1/images/7456b98f2f50e0e1d4c93fb4e375fe8a9174f397a5b1c0950915224f7f020ec4/download'})
skipping: [localhost] => (item={'imageName': 'Ansible Validated Content', 'filename': 'ansible-validated-content-bundle-1.1.tar.gz', 'arch': 'x86_64', 'datePublished': '2023-04-04T15:59:28.000Z', 'checksum': 'c0d2eb18e7a87c77f5660b41ce8dc85e5e64841e95986a553ae90edecdc30f0c', 'downloadHref': 'https://api.access.redhat.com/management/v1/images/c0d2eb18e7a87c77f5660b41ce8dc85e5e64841e95986a553ae90edecdc30f0c/download'})
skipping: [localhost] => (item={'imageName': 'Ansible Automation Platform 2.3 Setup', 'filename': 'ansible-automation-platform-setup-2.3-2.tar.gz', 'arch': 'x86_64', 'datePublished': '2023-03-16T13:00:52.000Z', 'checksum': '879e97e4c63de3727657284eb05a3a9e9897c66bd5059183d804d20f579c75a0', 'downloadHref': 'https://api.access.redhat.com/management/v1/images/879e97e4c63de3727657284eb05a3a9e9897c66bd5059183d804d20f579c75a0/download'})

TASK [aap_setup_download : Extract the name of the downloaded installer to aap_setup_down_installer_file] ********************************************************************************ok: [localhost]

TASK [aap_setup_download : debug] ********************************************************************************************************************************************************ok: [localhost] => {
    "aap_setup_down_installer_file": "/var/tmp/ansible-automation-platform-setup-bundle-2.3-2.1.tar.gz"
}
philthynz commented 1 year ago

@djdanielsson No problem. When does this go into the next galaxy package?