e7e5504a9e
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
173 lines
3.4 KiB
YAML
173 lines
3.4 KiB
YAML
- name: Check AFS mounted
|
|
stat:
|
|
path: "/afs/openstack.org/mirror"
|
|
register: afs_mirror
|
|
- name: Sanity check AFS
|
|
assert:
|
|
that:
|
|
- afs_mirror.stat.exists
|
|
|
|
- name: Install apache2
|
|
apt:
|
|
name:
|
|
- apache2
|
|
- apache2-utils
|
|
state: present
|
|
|
|
- name: Rewrite module
|
|
apache2_module:
|
|
state: present
|
|
name: rewrite
|
|
|
|
- name: Substitute module
|
|
apache2_module:
|
|
state: present
|
|
name: substitute
|
|
|
|
- name: Cache module
|
|
apache2_module:
|
|
state: present
|
|
name: cache
|
|
|
|
- name: Cache disk module
|
|
apache2_module:
|
|
state: present
|
|
name: cache_disk
|
|
|
|
- name: Proxy module
|
|
apache2_module:
|
|
state: present
|
|
name: proxy
|
|
|
|
- name: HTTP Proxy module
|
|
apache2_module:
|
|
state: present
|
|
name: proxy_http
|
|
|
|
- name: Apache macro module
|
|
apache2_module:
|
|
state: present
|
|
name: macro
|
|
|
|
- name: Apache 2 ssl module
|
|
apache2_module:
|
|
state: present
|
|
name: ssl
|
|
|
|
- name: Apache headers module
|
|
apache2_module:
|
|
state: present
|
|
name: headers
|
|
|
|
- name: Apache webroot
|
|
file:
|
|
path: '{{ www_base }}'
|
|
state: directory
|
|
owner: root
|
|
group: root
|
|
|
|
- name: Apache www root
|
|
file:
|
|
path: '{{ www_root }}'
|
|
state: directory
|
|
owner: root
|
|
group: root
|
|
|
|
- name: AFS content symlinks
|
|
file:
|
|
src: '{{ mirror_root }}/{{ item }}'
|
|
dest: '{{ www_root }}/{{ item }}'
|
|
state: link
|
|
owner: root
|
|
group: root
|
|
follow: false
|
|
with_items:
|
|
- apt-puppetlabs
|
|
- centos
|
|
- centos-stream
|
|
- ceph-deb-nautilus
|
|
- ceph-deb-octopus
|
|
- ceph-deb-quincy
|
|
- deb-docker
|
|
- debian
|
|
- debian-security
|
|
- debian-openstack
|
|
- epel
|
|
- fedora
|
|
- logs
|
|
- openeuler
|
|
- opensuse
|
|
- ubuntu
|
|
- ubuntu-ports
|
|
- ubuntu-cloud-archive
|
|
- wheel
|
|
- yum-puppetlabs
|
|
|
|
- name: Install robots.txt
|
|
copy:
|
|
src: robots.txt
|
|
dest: '{{ www_root }}'
|
|
owner: root
|
|
group: root
|
|
mode: 0444
|
|
|
|
- name: Install wheel_header.html
|
|
copy:
|
|
src: wheel_header.html
|
|
dest: '{{ www_base }}'
|
|
owner: root
|
|
group: root
|
|
mode: 0444
|
|
|
|
- name: Apache proxy cache
|
|
file:
|
|
path: /var/cache/apache2/proxy
|
|
owner: www-data
|
|
group: www-data
|
|
mode: 0755
|
|
state: directory
|
|
|
|
- name: Set mirror servername and alias
|
|
set_fact:
|
|
apache_server_name: '{{ inventory_hostname }}'
|
|
# Strip the numeric host value (like mirror01.region.provider.o.o
|
|
# becomes mirror.region...) for the serveralias
|
|
apache_server_alias: '{{ inventory_hostname | regex_replace("^mirror\d\d\.", "mirror.") }}'
|
|
|
|
- name: Copy apache tuning
|
|
copy:
|
|
src: apache-connection-tuning
|
|
dest: /etc/apache2/conf-enabled/connection-tuning.conf
|
|
owner: root
|
|
group: root
|
|
mode: 0644
|
|
notify: restart apache2
|
|
|
|
- name: Create mirror virtual host
|
|
template:
|
|
src: mirror.vhost.j2
|
|
dest: /etc/apache2/sites-available/mirror.conf
|
|
notify:
|
|
- reload apache2
|
|
|
|
- name: Make sure default site disabled
|
|
command: a2dissite 000-default.conf
|
|
args:
|
|
removes: /etc/apache2/sites-enabled/000-default.conf
|
|
|
|
- name: Enable mirror virtual host
|
|
command: a2ensite mirror
|
|
args:
|
|
creates: /etc/apache2/sites-enabled/mirror.conf
|
|
notify:
|
|
- restart apache2
|
|
|
|
# Clean apache cache once an hour, keep size down to 70GiB.
|
|
- name: Proxy cleanup cron job
|
|
cron:
|
|
name: Apache cache cleanup
|
|
state: present
|
|
job: /usr/bin/flock -n /var/run/htcacheclean.lock /usr/bin/htcacheclean -n -p /var/cache/apache2/proxy -t -l 60000M > /dev/null
|
|
minute: '0'
|
|
hour: '*'
|