diff --git a/releasenotes/notes/Add-CentOS-support-05f2d1302b7ee2e7.yaml b/releasenotes/notes/Add-CentOS-support-05f2d1302b7ee2e7.yaml new file mode 100644 index 0000000..c597fd9 --- /dev/null +++ b/releasenotes/notes/Add-CentOS-support-05f2d1302b7ee2e7.yaml @@ -0,0 +1,4 @@ +--- +features: + - CentOS7/RHEL support has been added to the ceph_client role. + - Only Ceph repos are supported for now. diff --git a/tasks/ceph_install.yml b/tasks/ceph_install.yml index 54bb98b..48cf0c8 100644 --- a/tasks/ceph_install.yml +++ b/tasks/ceph_install.yml @@ -13,9 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -- include: ceph_install_apt.yml - static: no - when: - - ansible_pkg_mgr == 'apt' +- include: "ceph_install_{{ ansible_pkg_mgr }}.yml" tags: - ceph-apt-packages + - ceph-yum-packages diff --git a/tasks/ceph_install_yum.yml b/tasks/ceph_install_yum.yml new file mode 100644 index 0000000..3020aea --- /dev/null +++ b/tasks/ceph_install_yum.yml @@ -0,0 +1,31 @@ +--- +# Copyright 2017, Marc Gariépy +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +- name: Install ceph packages + yum: + name: '{{ item.1 }}' + state: "{{ ceph_client_package_state }}" + register: install_packages + until: install_packages|success + retries: 5 + delay: 2 + with_subelements: + - "{{ ceph_components }}" + - package + when: inventory_hostname in groups[item.0.component] + notify: + - Restart os services + tags: + - ceph-yum-packages diff --git a/tasks/ceph_preinstall.yml b/tasks/ceph_preinstall.yml index eb5b0da..b131a42 100644 --- a/tasks/ceph_preinstall.yml +++ b/tasks/ceph_preinstall.yml @@ -14,9 +14,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -- include: ceph_preinstall_apt.yml +- include: "ceph_preinstall_{{ ansible_pkg_mgr }}.yml" static: no - when: - - ansible_pkg_mgr == 'apt' tags: - ceph-apt-keys + - ceph-rpm-keys + - ceph-repos diff --git a/tasks/ceph_preinstall_yum.yml b/tasks/ceph_preinstall_yum.yml new file mode 100644 index 0000000..694967b --- /dev/null +++ b/tasks/ceph_preinstall_yum.yml @@ -0,0 +1,54 @@ +--- +# Copyright 2017 Marc Gariépy +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +- name: Add ceph rpm key + rpm_key: + key: "{{ ceph_gpg_keys }}" + state: "present" + register: add_keys + until: add_keys|success + failed_when: false + retries: 5 + delay: 2 + when: ceph_pkg_source == 'ceph' + tags: + - ceph-rpm-keys + +- name: Add ceph repo + yum_repository: + name: ceph + description: "Ceph packages for $basearch" + file: ceph + baseurl: "{{ceph_yum_repo_url}}/$basearch" + gpgcheck: yes + enabled: yes + gpgkey: "{{ ceph_gpg_keys }}" + state: present + tags: + - ceph-repos + +- name: Add ceph noarch repo + yum_repository: + name: ceph-noarch + description: "Ceph noarch packages" + file: ceph + baseurl: "{{ceph_yum_repo_url}}/noarch" + gpgcheck: yes + enabled: yes + gpgkey: "{{ ceph_gpg_keys }}" + state: present + tags: + - ceph-repos + diff --git a/vars/redhat.yml b/vars/redhat.yml index cad6f01..e695b64 100644 --- a/vars/redhat.yml +++ b/vars/redhat.yml @@ -12,3 +12,12 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. + +# Ceph GPG Keys +ceph_gpg_keys: + - key: 'https://download.ceph.com/keys/release.asc' + +ceph_repo_url_region: "download" # see here for other mirros http://docs.ceph.com/docs/master/install/mirrors/ +ceph_yum_repo_url: "http://{{ ceph_repo_url_region }}.ceph.com/rpm-{{ ceph_stable_release }}/" + +# TODO mgariepy: add CentOS SIG ceph repo.