diff --git a/defaults/main.yml b/defaults/main.yml index ae42a51..5294e75 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -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') }}" diff --git a/releasenotes/notes/opensuse-mirror-url-variable-74d22825e808211e.yaml b/releasenotes/notes/opensuse-mirror-url-variable-74d22825e808211e.yaml new file mode 100644 index 0000000..af83ed6 --- /dev/null +++ b/releasenotes/notes/opensuse-mirror-url-variable-74d22825e808211e.yaml @@ -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/ diff --git a/tasks/pre_install_zypper.yml b/tasks/pre_install_zypper.yml index 18bd0f6..726ae5d 100644 --- a/tasks/pre_install_zypper.yml +++ b/tasks/pre_install_zypper.yml @@ -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 diff --git a/vars/suse-42.yml b/vars/suse-42.yml index a77d6fd..2d5e49b 100644 --- a/vars/suse-42.yml +++ b/vars/suse-42.yml @@ -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