SUSE: Add ability to configure external mirror for openSUSE

Allow deployers to choose a specific mirror by setting the
'pip_install_opensuse_mirror_url' variable

Change-Id: I4f4cc284ab7d1c3378e01737f9fade3afe251824
(cherry picked from commit 0544c622b2)
This commit is contained in:
Markos Chandras 2017-09-07 09:37:36 +01:00 committed by Jesse Pretorius (odyssey4me)
parent 550e77d0a1
commit 4f760bd4eb
4 changed files with 30 additions and 3 deletions

View File

@ -131,3 +131,11 @@ pip_get_pip_force: yes
# Set default mirror for CentOS repositories
# NOTE(mhayden): Ensure that the full path to the 'centos' directory is used.
#pip_install_centos_mirror_url: 'http://mirror.centos.org/centos'
## Set default mirror for openSUSE repositories
# NOTE(hwoarang): Ensure that the full path to the 'opensuse' directory is used.
# Additionally, set 'pip_install_opensuse_mirror_obs_url' to a mirror which also mirrors
# the OBS repositories. If you want to use the same mirror in both cases, then leave the
# 'pip_install_opensuse_mirror_obs_url' to its default value.
#pip_install_opensuse_mirror_url: 'http://widehat.opensuse.org'
pip_install_opensuse_mirror_obs_url: "{{ pip_install_opensuse_mirror_url | default('http://download.opensuse.org') }}"

View File

@ -0,0 +1,10 @@
---
features:
- |
Deployers can set ``pip_install_opensuse_mirror_url`` to use their
preferred mirror for the openSUSE repositories. They can also set the
``pip_install_opensuse_mirror_obs_url`` if they want to set a different
mirror for the OBS repositories. If they want to use the same mirror in
both cases then they can leave the latter variable to its default value.
The full list of mirrors and their capabilities can be obtained at
http://mirrors.opensuse.org/

View File

@ -14,6 +14,17 @@
# limitations under the License.
#
- name: Ensure that openSUSE repositories are using the correct openSUSE mirror
zypper_repository:
auto_import_keys: yes
autorefresh: yes
name: "{{ item.name }}"
repo: "{{ item.url }}"
with_items:
- { name: "repo-oss", url: "{{ pip_install_opensuse_mirror_url }}/distribution/leap/{{ ansible_distribution_version }}/repo/oss" }
- { name: "repo-update", url: "{{ pip_install_opensuse_mirror_url }}/update/leap/{{ ansible_distribution_version }}/oss/" }
when: pip_install_opensuse_mirror_url is defined
- name: Add zypper cloud repository
zypper_repository:
auto_import_keys: yes
@ -22,7 +33,5 @@
repo: "{{ item.uri }}"
runrefresh: yes
with_items: "{{ pip_install_external_repo }}"
when:
- user_external_repo_key is not defined
tags:
- add-repo-keys

View File

@ -15,7 +15,7 @@
pip_install_external_repo:
- name: "OBS:Cloud:OpenStack:Pike"
uri: "http://download.opensuse.org/repositories/Cloud:/OpenStack:/Pike/openSUSE_Leap_{{ ansible_distribution_version }}"
uri: "{{ pip_install_opensuse_mirror_obs_url }}/repositories/Cloud:/OpenStack:/Pike/openSUSE_Leap_{{ ansible_distribution_version }}"
pip_install_distro_build_packages:
- gcc