From 24e2ad8e5096923fca4f74cfe7aa21e6153186d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Han?= Date: Wed, 17 Dec 2014 18:01:44 +0100 Subject: [PATCH] Add multi-OS support for ICE MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ICE supports Ubuntu, CentOS and RHEL. Adding those. Signed-off-by: Sébastien Han --- roles/ceph-common/files/cephstableice.asc | 51 +++++++++++++++++++ roles/ceph-common/tasks/install_on_debian.yml | 12 +++++ roles/ceph-common/tasks/install_on_redhat.yml | 40 +++------------ roles/ceph-common/tasks/main.yml | 39 +++++++++++--- roles/ceph-common/templates/ice.repo.j2 | 8 --- .../ceph-common/templates/redhat_ice_repo.j2 | 9 ++++ roles/ceph-common/vars/main.yml | 2 + 7 files changed, 113 insertions(+), 48 deletions(-) create mode 100644 roles/ceph-common/files/cephstableice.asc delete mode 100644 roles/ceph-common/templates/ice.repo.j2 create mode 100644 roles/ceph-common/templates/redhat_ice_repo.j2 diff --git a/roles/ceph-common/files/cephstableice.asc b/roles/ceph-common/files/cephstableice.asc new file mode 100644 index 000000000..21a6db142 --- /dev/null +++ b/roles/ceph-common/files/cephstableice.asc @@ -0,0 +1,51 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- +Version: GnuPG v1.4.11 (GNU/Linux) + +mQINBFJxnXIBEAC4QhhJgpTJFeZ9pHLuGseS2C/MQwYzcSyJEoJoEnbooS8uwNZt +fMHBwcacML/Yq7CkVCXYbMM1tQVTTU31wnAZIb5nrvYHL4MNWoTzEFIEjAD0VHZW +bRmydFa9aDNjwrVE4xXhvMClmrv51we4qW+Ht5s3I8nn+hJRc6oeFKw7FhYqAsyL +htYRzNg0Ji+MiqBgeAC6IEwmKK/lsmz4FK/5RLnu9tKMJhziQZNQbHvv5pntVcnI +M4UJdUtepaf/GUk256MmFW1Qmfv2KxUlEcms1fPusBFjQDnCZi+qRuezTjpPsLAx +ramqc8Dj6N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99qDwZV +68Z+b5PK0v/Bmyd+biGQqLIbZypmiOUQqq7OkWPBIAg5P6y3PIi1KyWuRPvxJ33f +sIuDVVznAxSzKuYjwJ9QMvR6hTSyOOSFJsGr58Pc3p1atvEsiW4xQioYYieYZuyx +cb5ZjJmnnmv8AN1dwq3ETW1igiw/LTxATLZEHV4GM6i0SDghg9ricoyEqLzTzn2y +cjEDrBXQBucDDthuFk82FR8clihjeizKuqWo14QkjMUt/tW6q1eveamUs8aKVIpz +lNeHHf/aU/NA+w4rLNs49rQeKFOCA5ySSb55R6EBABtCnUdul3Xye5azKMfTVA07 +PweRzqCUKZuXYmbaZ8DzalrNL7a8btCHfzII8ohj+br1WeynFMpYqhgKfitlM/Ie +KlnNRKxeDgU6NN27y6DKIzzrdpz36yNaFtdn3O0XcNzayj80qJTLNA96nI0bcpoy +xvbSx50M7NRbYugFLkz54bo8U3fOXKdw7qC2eLqhq1RvQEt05qz1EvwA9Is= +=0eqL +-----END PGP PUBLIC KEY BLOCK----- diff --git a/roles/ceph-common/tasks/install_on_debian.yml b/roles/ceph-common/tasks/install_on_debian.yml index 256b28ce7..e6b7f6a84 100644 --- a/roles/ceph-common/tasks/install_on_debian.yml +++ b/roles/ceph-common/tasks/install_on_debian.yml @@ -22,6 +22,12 @@ state=present when: ceph_dev +- name: Install Intank Ceph Enterprise repository key + apt_key: > + data="{{ lookup('file', 'cephstableice.asc') }}" + state=present + when: ceph_stable_ice + - name: Add Ceph stable repository apt_repository: > repo="deb http://ceph.com/debian-{{ ceph_stable_release }}/ {{ ansible_lsb.codename }} main" @@ -34,6 +40,12 @@ state=present when: ceph_dev +- name: Add Inktank Ceph Enterprise repository + apt_repository: > + repo="deb file://{{ ceph_stable_ice_temp_path }} {{ ansible_lsb.codename }} main" + state=present + when: ceph_stable_ice + - name: Install Ceph apt: > pkg={{ item }} diff --git a/roles/ceph-common/tasks/install_on_redhat.yml b/roles/ceph-common/tasks/install_on_redhat.yml index 7dfd5df4f..b849bfc08 100644 --- a/roles/ceph-common/tasks/install_on_redhat.yml +++ b/roles/ceph-common/tasks/install_on_redhat.yml @@ -20,6 +20,12 @@ state=present when: ceph_dev +- name: Install Inktank Ceph Enterprise repository key + rpm_key: > + key=file://{{ ceph_stable_ice_temp_path }}/*/release.asc + state=present + when: ceph_stable_ice + - name: Add Ceph stable repository command: "rpm -U http://ceph.com/rpm-{{ ceph_stable_release }}/{{ ceph_stable_redhat_distro }}/noarch/ceph-release-1-0.el6.noarch.rpm creates=/etc/yum.repos.d/ceph.repo" when: ceph_stable @@ -28,39 +34,9 @@ command: "rpm -U http://gitbuilder.ceph.com/ceph-rpm-{{ ceph_dev_redhat_distro }}-x86_64-basic/ref/{{ ceph_dev_branch }}/noarch/ceph-release-1-0.{{ ceph_stable_redhat_distro }}.noarch.rpm creates=/etc/yum.repos.d/ceph.repo" when: ceph_dev -- name: Create package directory - file: > - path=/tmp/ice_repo - state=directory - owner=root - group=root - mode=0644 - when: ceph_stable_ice - -- name: Get ICE packages - get_url: > - url_username={{ ceph_stable_ice_user }} - url_password={{ ceph_stable_ice_password }} - url=https://download.inktank.com/enterprise/{{ ceph_stable_ice_version }}/ICE-{{ ceph_stable_ice_version }}-rhel7.tar.gz - dest=/tmp/ice_repo/ICE-{{ ceph_stable_ice_version }}-rhel7.tar.gz - when: ceph_stable_ice - -- name: Stat extracted repo files - stat: > - path=/tmp/ice_repo/repodata/repomd.xml - register: repo_exist - -- name: Extract packages - shell: cd /tmp/ice_repo && tar -xzf ICE-{{ ceph_stable_ice_version }}-rhel7.tar.gz - when: ceph_stable_ice and repo_exist.stat.exists == False - -- name: Move the extracted packages - shell: mv /tmp/ice_repo/ceph/*/* /tmp/ice_repo - when: ceph_stable_ice and repo_exist.stat.exists == False - -- name: Create repository +- name: Add Inktank Ceph Enterprise repository template: > - src=ice.repo.j2 + src=redhat_ice_repo.j2 dest=/etc/yum.repos.d/ice.repo owner=root group=root diff --git a/roles/ceph-common/tasks/main.yml b/roles/ceph-common/tasks/main.yml index dd2621055..c13876491 100644 --- a/roles/ceph-common/tasks/main.yml +++ b/roles/ceph-common/tasks/main.yml @@ -11,14 +11,6 @@ fail: "msg=Distribution not supported {{ ansible_os_family }}" when: "ansible_os_family not in ['Debian', 'RedHat']" -- name: Fail on wrong distribution with wrong repo - fail: "msg=Inktank Ceph Enterprise can not be installed on {{ ansible_os_family }}, Red Hat Enterprise Linux 7 only" - when: ansible_os_family == 'Debian' and ceph_stable_ice - -- name: Fail on wrong distribution with wrong repo - fail: "msg=Inktank Ceph Enterprise can not be installed on {{ ansible_os_family }}i {{ ansible_distribution_major_version }}, Red Hat Enterprise Linux 7 only" - when: ansible_os_family == 'RedHat' and ansible_distribution_major_version != '7' and ceph_stable_ice - - include: install_on_redhat.yml when: ansible_os_family == 'RedHat' @@ -63,3 +55,34 @@ value=4194303 state=present sysctl_file=/etc/sysctl.conf + +- name: Create package directory + file: > + path={{ ceph_stable_ice_temp_path }} + state=directory + owner=root + group=root + mode=0644 + when: ceph_stable_ice + +- name: Get ICE packages + get_url: > + url_username={{ ceph_stable_ice_user }} + url_password={{ ceph_stable_ice_password }} + url=https://download.inktank.com/enterprise/{{ ceph_stable_ice_version }}/ICE-{{ ceph_stable_ice_version }}-{{ ceph_stable_ice_distro }}.tar.gz + dest={{ ceph_stable_ice_temp_path }}/ICE-{{ ceph_stable_ice_version }}-{{ ceph_stable_ice_distro }}.tar.gz + when: ceph_stable_ice + +- name: Stat extracted repo files + stat: > + path={{ ceph_stable_ice_temp_path }}/ice_setup.py + register: repo_exist + when: ceph_stable_ice + +- name: Extract packages + shell: "cd {{ ceph_stable_ice_temp_path }} && tar -xzf ICE-{{ ceph_stable_ice_version }}-{{ ceph_stable_ice_distro }}.tar.gz" + when: ceph_stable_ice and repo_exist.stat.exists == False + +- name: Move the extracted packages + shell: "mv {{ ceph_stable_ice_temp_path }}/ceph/*/* {{ ceph_stable_ice_temp_path }}" + when: ceph_stable_ice and repo_exist.stat.exists == False diff --git a/roles/ceph-common/templates/ice.repo.j2 b/roles/ceph-common/templates/ice.repo.j2 deleted file mode 100644 index 0b47a2d4a..000000000 --- a/roles/ceph-common/templates/ice.repo.j2 +++ /dev/null @@ -1,8 +0,0 @@ -# {{ ansible_managed }} -[ice] -name=Inktank Ceph Enterprise - local packages for Ceph -baseurl=file:///tmp/ice_repo -enabled=1 -gpgcheck=0 -protect=1 -priority=1 diff --git a/roles/ceph-common/templates/redhat_ice_repo.j2 b/roles/ceph-common/templates/redhat_ice_repo.j2 new file mode 100644 index 000000000..9600dcb08 --- /dev/null +++ b/roles/ceph-common/templates/redhat_ice_repo.j2 @@ -0,0 +1,9 @@ +# {{ ansible_managed }} +[ice] +name=Inktank Ceph Enterprise - local packages for Ceph +baseurl=file://{{ ceph_stable_ice_temp_path }} +enabled=1 +gpgcheck=1 +type=rpm-md +priority=1 +gpgkey=file://{{ ceph_stable_ice_temp_path }}/release.asc diff --git a/roles/ceph-common/vars/main.yml b/roles/ceph-common/vars/main.yml index 58a89fc2e..8c8b8ed63 100644 --- a/roles/ceph-common/vars/main.yml +++ b/roles/ceph-common/vars/main.yml @@ -21,6 +21,8 @@ ceph_stable_redhat_distro: el7 # ENTERPRISE VERSION ceph_stable_ice: false # use Inktank Ceph Enterprise +#ceph_stable_ice_temp_path: /opt/ICE/ceph-repo/ +#ceph_stable_ice_distro: # Please check the download website for the supported versions. #ceph_stable_ice_version: #ceph_stable_ice_user: #ceph_stable_ice_password: