I’ve deployed galaxy into k8s (Rancher, not OpenShift, running with nginx ingress) utilizing the galaxy-operator (GitHub - ansible/galaxy-operator: Galaxy-Operator) successfully. I used version 2024.5.1 to do it. I’m doing testing by pointing a local repository’s ansible.cfg to use the repo to download collections via ansible-galaxy collection install. It seems that if TLS is enabled on the ingress, using ansible-galaxy collection install fails. See below:
$ ansible-galaxy collection install community.general -c --force
Starting galaxy collection install process
Process install dependency map
Starting collection install process
Downloading http://onpremgalaxy.mirror.com/api/galaxy/v3/plugin/ansible/content/mirror/collections/artifacts/community-general-8.6.0.tar.gz to /home/user/.ansible/tmp/ansible-local-272219dow9nwwb/tmpf6pa4_kw/community-general-8.6.0-vpitt0j7
ERROR! Failed to download collection tar from 'mirror' due to the following unforeseen error: HTTP Error 308: Permanent Redirect. HTTP Error 308: Permanent Redirect
If I turn off TLS for the ingress, ansible-galaxy collection install works fine:
$ ansible-galaxy collection install community.general -c --force
Starting galaxy collection install process
Process install dependency map
Starting collection install process
Downloading http://onpremgalaxy.mirror.com/api/galaxy/v3/plugin/ansible/content/mirror/collections/artifacts/community-general-8.6.0.tar.gz to /home/user/.ansible/tmp/ansible-local-2723325_o9jdnx/tmp5stkrib_/community-general-8.6.0-yuaw1goz
Installing 'community.general:8.6.0' to '/home/user/.ansible/collections/ansible_collections/community/general'
Not sure if this is a config setting I’m missing. Doesn’t seem to be one for ansible-galaxy, couldn’t find it inside the galaxy-operator project or Configuration options - Galaxy NG.
Can you share what galaxy-web-svc and galaxy-ingress looks like? From what I can tell in the code, the service is templated based on ingress_type: route or loadbalancer, but the ingress/route is based on ingress_type: route or ingress. So both loadbalancer and ingress look to be half-broken to me.
galaxy.ingress.yaml.j2 wants to point ingress to port 24880, but that port is only configured in galaxy-web.service.yaml.j2 for loadbalancer, even on the latest commit. There’s no configured service ports for ingress, and no ingress/route configured for loadbalancer.
Yup, that command works fine, curl correctly follows the redirects and downloads the tar.gz file. That’s part of my confusion, I’m not sure if this is an ansible-galaxy CLI issue, the operator, or the containers.
$ curl --output hi.tar.gz -kL http://onpremgalaxy.mirror.com/api/galaxy/v3/plugin/ansible/content/mirror/collections/artifacts/community-general-8.6.0.tar.gz
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 164 100 164 0 0 1244 0 --:--:-- --:--:-- --:--:-- 1251
0 0 0 0 0 0 0 0 --:--:-- 0:00:01 --:--:-- 0
100 2584k 100 2584k 0 0 1521k 0 0:00:01 0:00:01 --:--:-- 8612k
$ ls -l hi.tar.gz
-rw-rw-r-- 1 user user 2646969 May 9 14:30 hi.tar.gz
Testing with ansible-galaxy collection install
$ ansible-galaxy collection install community.general -c --force
Starting galaxy collection install process
Process install dependency map
Starting collection install process
Downloading http://onpremgalaxy.mirror.com/api/galaxy/v3/plugin/ansible/content/mirror/collections/artifacts/community-general-8.6.0.tar.gz to /home/user/.ansible/tmp/ansible-local-285424ntw2bzyd/tmp3mkwqloi/community-general-8.6.0-fgwkuxqp
ERROR! Failed to download collection tar from 'mirror' due to the following unforeseen error: HTTP Error 308: Permanent Redirect. HTTP Error 308: Permanent Redirect
and for fun, creating an ansible.cfg pointing at the non-SSL URL for galaxy.ansible.com, which works:
$ ansible-galaxy collection install community.general -c --force
Starting galaxy collection install process
Process install dependency map
Starting collection install process
Downloading https://galaxy.ansible.com/api/v3/plugin/ansible/content/published/collections/artifacts/community-general-8.6.0.tar.gz to /home/user/.ansible/tmp/ansible-local-285454jgn00g07/tmp04t6s12c/community-general-8.6.0-2l3yt91o
Installing 'community.general:8.6.0' to '/home/user/.ansible/collections/ansible_collections/community/general'
community.general:8.6.0 was installed successfully
$ cat ansible.cfg
[galaxy]
server_list = mirror
[galaxy_server.mirror]
url=http://galaxy.ansible.com/