From 7e10b0325be49c93ac431b1d95802f7bd80a59e3 Mon Sep 17 00:00:00 2001 From: Shengjing Zhu Date: Wed, 8 Feb 2017 11:41:48 +0800 Subject: [PATCH] add ceph_mirror variable Closes: #1282 Signed-off-by: Shengjing Zhu --- group_vars/all.yml.sample | 3 ++- roles/ceph-common/defaults/main.yml | 3 ++- .../tasks/installs/redhat_ceph_repository.yml | 9 ++++++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/group_vars/all.yml.sample b/group_vars/all.yml.sample index 590f2c2ba..375583adb 100644 --- a/group_vars/all.yml.sample +++ b/group_vars/all.yml.sample @@ -114,9 +114,10 @@ dummy: # COMMUNITY VERSION #ceph_stable: false # use ceph stable branch +#ceph_mirror: http://download.ceph.com #ceph_stable_key: https://download.ceph.com/keys/release.asc #ceph_stable_release: jewel # ceph stable release -#ceph_stable_repo: "http://download.ceph.com/debian-{{ ceph_stable_release }}" +#ceph_stable_repo: "{{ ceph_mirror }}/debian-{{ ceph_stable_release }}" ###################################### # Releases name to number dictionary # diff --git a/roles/ceph-common/defaults/main.yml b/roles/ceph-common/defaults/main.yml index 7de9e9d83..e6dddb528 100644 --- a/roles/ceph-common/defaults/main.yml +++ b/roles/ceph-common/defaults/main.yml @@ -106,9 +106,10 @@ ceph_use_distro_backports: false # DEBIAN ONLY # COMMUNITY VERSION ceph_stable: false # use ceph stable branch +ceph_mirror: http://download.ceph.com ceph_stable_key: https://download.ceph.com/keys/release.asc ceph_stable_release: jewel # ceph stable release -ceph_stable_repo: "http://download.ceph.com/debian-{{ ceph_stable_release }}" +ceph_stable_repo: "{{ ceph_mirror }}/debian-{{ ceph_stable_release }}" ###################################### # Releases name to number dictionary # diff --git a/roles/ceph-common/tasks/installs/redhat_ceph_repository.yml b/roles/ceph-common/tasks/installs/redhat_ceph_repository.yml index 94a59604e..a90309653 100644 --- a/roles/ceph-common/tasks/installs/redhat_ceph_repository.yml +++ b/roles/ceph-common/tasks/installs/redhat_ceph_repository.yml @@ -7,11 +7,18 @@ - name: add ceph stable repository package: - name: http://download.ceph.com/rpm-{{ ceph_stable_release }}/{{ ceph_stable_redhat_distro }}/noarch/ceph-release-1-0.{{ ceph_stable_redhat_distro|replace('rhel', 'el') }}.noarch.rpm + name: "{{ ceph_mirror }}/rpm-{{ ceph_stable_release }}/{{ ceph_stable_redhat_distro }}/noarch/ceph-release-1-0.{{ ceph_stable_redhat_distro|replace('rhel', 'el') }}.noarch.rpm" state: present changed_when: false when: ceph_stable +- name: change download url to ceph mirror + replace: + name: /etc/yum.repos.d/ceph.repo + regexp: http://download.ceph.com + replace: "{{ ceph_mirror }}" + when: ceph_mirror != "http://download.ceph.com" + # we must use curl instead of ansible's uri module because SNI support in # Python is only available in 2.7.9 and later, and most supported distributions # don't have that version, so a request to https fails.