system-config/playbooks/roles/mirror
Cédric Jeanneret e7e5504a9e Correct (again) how ansible-galaxy proxy is configured
The mix of <Location> and ProxyPass [path] <target> lead to some issue.
This patch corrects them and makes the config more consistent.

Until now, the last URI was actually an error page from the main galaxy
website. With this change, we now hit the S3 bucket as we should,
allowing ansible-galaxy to download the archive, validate its checksum,
and install the intended collection/role.

This patch was fully tested locally using the httpd container image, a
minimal configuration adding only the needed modules and the
ansible-galaxy vhost/proxy, and running ansible-galaxy directly.

In addition, this patch also makes a better testing of the proxy, using
cURL until we actually download the file.
Since ansible galaxy will provide a file under any condition, we also
assert the downloaded file is really what it should be - a plain
archive. If it's a miss on S3 side, it would be a JSON. And if we get an
ansible galaxy answer, that would be an HTML file.

The following commands were used:
Run the container:
podman run --rm --security-opt label=disable \
        -v ./httpd.conf:/usr/local/apache2/conf/httpd.conf:ro \
        -p 8080:8080 httpd:2.4

Run ansible-galaxy while ensuring we don't rely on its own internal
cache:
rm -rf operator ~/.ansible/galaxy_cache/api.json
ansible-galaxy collection download -vvvvvvv \
        -s http://localhost:8080/ -p ./operator tripleo.operator

Then, the following URI were shown in the ansible-galaxy log:

http://localhost:8080/
http://localhost:8080/api
http://localhost:8080/api/v2/collections/tripleo/operator/
http://localhost:8080/api/v2/collections/tripleo/operator/versions/?page_size=100
http://localhost:8080/api/v2/collections/tripleo/operator/versions/0.9.0/

Then, the actual download:
http://localhost:8080/download/tripleo-operator-0.9.0.tar.gz

Then the checksum validation, and eventually it ended with:
Collection 'tripleo.operator:0.9.0' was downloaded successfully

Change-Id: Ibfe846b59bf987df3f533802cb329e15ce83500b
2023-01-16 14:21:40 +01:00
..
defaults Create opendev mirrors 2019-05-21 11:08:25 +10:00
files Override DOCTYPE in wheel cache autoindex 2022-01-30 18:54:12 +00:00
handlers Notify apache2 reload on updates to mirror vhost 2022-07-21 21:53:25 +00:00
tasks Correct (again) how ansible-galaxy proxy is configured 2023-01-16 14:21:40 +01:00
templates Correct (again) how ansible-galaxy proxy is configured 2023-01-16 14:21:40 +01:00
README.rst Create opendev mirrors 2019-05-21 11:08:25 +10:00

README.rst

Configure an opendev mirror

This role installs and configures a mirror node

Role Variables