Merge "Add option to prefer https/ssl in configure-mirrors"

This commit is contained in:
Zuul 2020-05-26 12:09:36 +00:00 committed by Gerrit Code Review
commit 4bd67e2bbb
9 changed files with 51 additions and 14 deletions

View File

@ -7,6 +7,13 @@ An ansible role to configure services to use mirrors.
The base host for mirror servers.
.. zuul:rolevar:: mirror_use_ssl
:default: False
Use ssl to communicate to mirror endpoints. Note if the platform
cannot use ssl (for example Ubuntu Xenial apt needs additional packages)
this will still use http instead of https when set for that platform.
.. zuul:rolevar:: pypi_fqdn
:default: {{ mirror_fqdn }}

View File

@ -1,5 +1,12 @@
set_apt_mirrors_trusted: False
mirror_fqdn: "{{ zuul_site_mirror_fqdn|default(omit) }}"
pypi_fqdn: "{{ mirror_fqdn }}"
pypi_mirror: "http://{{ pypi_fqdn }}/pypi/simple"
set_apt_mirrors_trusted: False
wheel_mirror: "http://{{ mirror_fqdn }}/wheel/{{ ansible_distribution | lower }}-{{ ansible_distribution_version }}-{{ ansible_architecture | lower }}"
mirror_use_ssl: False
http_or_https: >-
{%- if mirror_use_ssl and ansible_distribution_release not in ['xenial', 'stretch'] -%}
https
{%- else -%}
http
{%- endif -%}
pypi_mirror: "{{ http_or_https }}://{{ pypi_fqdn }}/pypi/simple"
wheel_mirror: "{{ http_or_https }}://{{ mirror_fqdn }}/wheel/{{ ansible_distribution | lower }}-{{ ansible_distribution_version }}-{{ ansible_architecture | lower }}"

View File

@ -1,2 +1,2 @@
package_mirror: "http://{{ mirror_fqdn }}/{{ ansible_distribution | lower }}"
epel_mirror: "http://{{ mirror_fqdn }}/epel"
package_mirror: "{{ http_or_https }}://{{ mirror_fqdn }}/{{ ansible_distribution | lower }}"
epel_mirror: "{{ http_or_https }}://{{ mirror_fqdn }}/epel"

View File

@ -1,2 +1,2 @@
package_mirror: "http://{{ mirror_fqdn }}/{{ ansible_distribution | lower }}"
security_mirror: "http://{{ mirror_fqdn }}/{{ ansible_distribution | lower }}-security"
package_mirror: "{{ http_or_https }}://{{ mirror_fqdn }}/{{ ansible_distribution | lower }}"
security_mirror: "{{ http_or_https }}://{{ mirror_fqdn }}/{{ ansible_distribution | lower }}-security"

View File

@ -1 +1 @@
package_mirror: "http://{{ mirror_fqdn }}/{{ ansible_distribution | lower }}"
package_mirror: "{{ http_or_https }}://{{ mirror_fqdn }}/{{ ansible_distribution | lower }}"

View File

@ -1,7 +1,7 @@
package_mirror: "http://{{ mirror_fqdn }}/opensuse"
wheels_slug: "{%- if ansible_distribution == 'openSUSE Tumbleweed' -%}
opensuse-tumbleweed-{{ ansible_architecture | lower }}
{%- else -%}
{{ ansible_distribution | lower }}-{{ ansible_distribution_version }}-{{ ansible_architecture | lower }}
{%- endif -%}"
wheel_mirror: "http://{{ mirror_fqdn }}/wheel/{{ wheels_slug }}"
package_mirror: "{{ http_or_https }}://{{ mirror_fqdn }}/opensuse"
wheel_mirror: "{{ http_or_https }}://{{ mirror_fqdn }}/wheel/{{ wheels_slug }}"

View File

@ -1 +1 @@
package_mirror: "http://{{ mirror_fqdn }}/{{ ansible_distribution | lower }}-ports"
package_mirror: "{{ http_or_https }}://{{ mirror_fqdn }}/{{ ansible_distribution | lower }}-ports"

View File

@ -1 +1 @@
package_mirror: "http://{{ mirror_fqdn }}/{{ ansible_distribution | lower }}"
package_mirror: "{{ http_or_https }}://{{ mirror_fqdn }}/{{ ansible_distribution | lower }}"

View File

@ -1,4 +1,4 @@
- name: Test the configure-mirrors role
- name: Test the configure-mirrors role with http
hosts: all
roles:
- role: configure-mirrors
@ -9,7 +9,30 @@
set_fact:
emacs_package: app-editors/emacs
when: ansible_distribution == 'Gentoo'
- name: Install a package to sanity check the mirror configuration
- name: Install a package to sanity check the http mirror configuration
package:
name: "{{ emacs_package | default('emacs') }}"
state: "present"
become: yes
- name: Test the configure-mirrors role with https
hosts: all
roles:
- role: configure-mirrors
mirror_fqdn: "{{ zuul_site_mirror_fqdn }}"
mirror_use_ssl: True
set_apt_mirrors_trusted: True
post_tasks:
- name: Set emacs package fact for gentoo
set_fact:
emacs_package: app-editors/emacs
when: ansible_distribution == 'Gentoo'
- name: Remove existing emacs package install
package:
name: "{{ emacs_package | default('emacs') }}"
state: "absent"
become: yes
- name: Install a package to sanity check the https mirror configuration
package:
name: "{{ emacs_package | default('emacs') }}"
state: "present"