diff --git a/playbooks/roles/mirror/templates/mirror.vhost.j2 b/playbooks/roles/mirror/templates/mirror.vhost.j2 index 756b6c51a6..45dbb614e3 100644 --- a/playbooks/roles/mirror/templates/mirror.vhost.j2 +++ b/playbooks/roles/mirror/templates/mirror.vhost.j2 @@ -110,6 +110,14 @@ ErrorLogFormat "[%{cu}t] [%-m:%l] [pid %P:tid %T] %7F: %E: [client\ %a] %M% , \ RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_URI} !-d RewriteRule (.*)-(.*) $1.$2 [N] + # Ansible Galaxy + CacheEnable disk "/galaxy" + ProxyPass "/galaxy/" "https://galaxy.ansible.com/" ttl=120 keepalive=On retry=0 + ProxyPassReverse "/galaxy/" "https://galaxy.ansible.com/" + CacheEnable disk "/galaxy-s3" + ProxyPass "/galaxy-s3/" "https://ansible-galaxy.s3.amazonaws.com/" ttl=120 keepalive=On retry=0 + ProxyPassReverse "/galaxy-s3/" "https://ansible-galaxy.s3.amazonaws.com/" + ErrorLog /var/log/apache2/mirror_$port_error.log LogLevel warn CustomLog /var/log/apache2/mirror_$port_access.log combined-cache diff --git a/testinfra/test_mirror.py b/testinfra/test_mirror.py index 270217ab3e..6891898234 100644 --- a/testinfra/test_mirror.py +++ b/testinfra/test_mirror.py @@ -88,3 +88,40 @@ def test_quay_mirror(host): assert 'quay' in cmd.stdout # TODO test RHRegistryMirror + +def test_galaxy_mirror(host): + for addr in host.addr(host.backend.host).ipv4_addresses: + cmd = host.run( + "wget --no-check-certificate -qO- https://%s/galaxy/" % addr) + assert 'Ansible Galaxy' in cmd.stdout + + cmd = host.run("wget -qO- http://%s/galaxy/" % addr) + assert 'Ansible Galaxy' in cmd.stdout + + cmd = host.run("wget --no-check-certificate -O- " + "https://%s/galaxy/download/community-general-4.0.2.tar.gz" % + addr) + assert '/galaxy-s3/artifact/' in cmd.stderr + + cmd = host.run("wget -O- " + "http://%s/galaxy/download/community-general-4.0.2.tar.gz" % + addr) + assert '/galaxy-s3/artifact/' in cmd.stderr + + for addr in host.addr(host.backend.host).ipv6_addresses: + cmd = host.run("wget --no-check-certificate -qO- " + "https://[%s]/galaxy/" % addr) + assert 'Ansible Galaxy' in cmd.stdout + + cmd = host.run("wget -qO- http://[%s]/galaxy/" % addr) + assert 'Ansible Galaxy' in cmd.stdout + + cmd = host.run("wget --no-check-certificate -O- " + "https://[%s]/galaxy/download/community-general-4.0.2.tar.gz" % + addr) + assert '/galaxy-s3/artifact/' in cmd.stderr + + cmd = host.run("wget -O- " + "http://[%s]/galaxy/download/community-general-4.0.2.tar.gz" % + addr) + assert '/galaxy-s3/artifact/' in cmd.stderr