From e4d8d7836e367821f5f61c306c27123826fc3c7d Mon Sep 17 00:00:00 2001 From: Jonathan Rosser Date: Tue, 16 Mar 2021 09:18:32 +0000 Subject: [PATCH] Remove references to unsupported operating systems All references to Gentoo, SUSE, Debian stretch and Centos-7 are removed. Conditional tasks, ternary operators and variables are simplified where possible OS specific variables files are generalised where possible Change-Id: I8ccd8ef5cbb4a29b782418ffa33e635962f0941e --- meta/main.yml | 10 ++-- tasks/ceph_install.yml | 2 +- tasks/ceph_preinstall_dnf.yml | 95 ++++++++++++++++++++++++++++++++++- tasks/ceph_preinstall_yum.yml | 94 ---------------------------------- tasks/main.yml | 2 +- vars/suse.yml | 29 ----------- 6 files changed, 100 insertions(+), 132 deletions(-) mode change 120000 => 100644 tasks/ceph_preinstall_dnf.yml delete mode 100644 tasks/ceph_preinstall_yum.yml delete mode 100644 vars/suse.yml diff --git a/meta/main.yml b/meta/main.yml index fa29f41..a6db849 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -22,17 +22,15 @@ galaxy_info: platforms: - name: Debian versions: - - stretch + - buster - name: Ubuntu versions: - - xenial - bionic + - focal - name: EL versions: - - 7 - - name: opensuse - versions: - - all + - 8 + categories: - cloud - ceph diff --git a/tasks/ceph_install.yml b/tasks/ceph_install.yml index 938c4a0..561fbd5 100644 --- a/tasks/ceph_install.yml +++ b/tasks/ceph_install.yml @@ -17,7 +17,7 @@ package: name: '{{ ceph_client_filtered_packages }}' state: "{{ ceph_client_package_state }}" - update_cache: "{{ (ansible_facts['pkg_mgr'] in ['apt', 'zypper']) | ternary('yes', omit) }}" + update_cache: "{{ (ansible_facts['pkg_mgr'] == 'apt') | ternary('yes', omit) }}" cache_valid_time: "{{ (ansible_facts['pkg_mgr'] == 'apt') | ternary(cache_timeout, omit) }}" register: install_packages until: install_packages is success diff --git a/tasks/ceph_preinstall_dnf.yml b/tasks/ceph_preinstall_dnf.yml deleted file mode 120000 index 527e338..0000000 --- a/tasks/ceph_preinstall_dnf.yml +++ /dev/null @@ -1 +0,0 @@ -ceph_preinstall_yum.yml \ No newline at end of file diff --git a/tasks/ceph_preinstall_dnf.yml b/tasks/ceph_preinstall_dnf.yml new file mode 100644 index 0000000..159a043 --- /dev/null +++ b/tasks/ceph_preinstall_dnf.yml @@ -0,0 +1,94 @@ +--- +# 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: Copy EPEL gpg keyfile to the key location + copy: + src: "gpg/{{ item.key | basename }}" + dest: "{{ item.key }}" + mode: '0644' + with_items: "{{ epel_gpg_keys }}" + when: + - ansible_facts['pkg_mgr'] == 'dnf' + +- name: Install EPEL gpg keys + rpm_key: "{{ key }}" + with_items: "{{ epel_gpg_keys }}" + loop_control: + loop_var: key + when: + - ansible_facts['pkg_mgr'] == 'dnf' + register: _add_epel_keys + until: _add_epel_keys is success + retries: 5 + delay: 2 + +- name: Install the EPEL repository + yum_repository: + name: ceph-client-deps + baseurl: "{{ (centos_epel_mirror | default ('http://download.fedoraproject.org/pub/epel')) ~ '/' ~ ansible_facts['distribution_major_version'] ~ '/Everything/' ~ ansible_facts['architecture'] }}" + description: "Extra Packages for Enterprise Linux {{ ansible_facts['distribution_major_version'] }} - $basearch" + gpgcheck: yes + enabled: yes + state: present + includepkgs: 'lttng-ust*, userspace-rcu, libbabeltrace, leveldb, liboath' + when: + - ansible_facts['pkg_mgr'] == 'dnf' + register: install_epel_repo + until: install_epel_repo is success + retries: 5 + delay: 2 + +- name: Copy Ceph gpg keyfile to the key location + copy: + src: "gpg/{{ item.key | basename }}" + dest: "{{ item.key }}" + mode: '0644' + with_items: "{{ ceph_gpg_keys }}" + when: + - ceph_pkg_source == 'ceph' + +- name: Install Ceph gpg keys + rpm_key: "{{ key }}" + with_items: "{{ ceph_gpg_keys }}" + loop_control: + loop_var: key + when: + - ceph_pkg_source == 'ceph' + register: _add_ceph_keys + until: _add_ceph_keys is success + retries: 5 + delay: 2 + +- 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 + priority: 50 + state: present + +- 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 + priority: 50 + state: present diff --git a/tasks/ceph_preinstall_yum.yml b/tasks/ceph_preinstall_yum.yml deleted file mode 100644 index 9804fb7..0000000 --- a/tasks/ceph_preinstall_yum.yml +++ /dev/null @@ -1,94 +0,0 @@ ---- -# 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: Copy EPEL gpg keyfile to the key location - copy: - src: "gpg/{{ item.key | basename }}" - dest: "{{ item.key }}" - mode: '0644' - with_items: "{{ epel_gpg_keys }}" - when: - - ansible_facts['pkg_mgr'] in ['yum','dnf'] - -- name: Install EPEL gpg keys - rpm_key: "{{ key }}" - with_items: "{{ epel_gpg_keys }}" - loop_control: - loop_var: key - when: - - ansible_facts['pkg_mgr'] in ['yum','dnf'] - register: _add_epel_keys - until: _add_epel_keys is success - retries: 5 - delay: 2 - -- name: Install the EPEL repository - yum_repository: - name: ceph-client-deps - baseurl: "{{ (centos_epel_mirror | default ('http://download.fedoraproject.org/pub/epel')) ~ '/' ~ ansible_facts['distribution_major_version'] ~ ((ansible_facts['distribution_major_version'] is version('8', '<')) | ternary('/', '/Everything/')) ~ ansible_facts['architecture'] }}" - description: "Extra Packages for Enterprise Linux {{ ansible_facts['distribution_major_version'] }} - $basearch" - gpgcheck: yes - enabled: yes - state: present - includepkgs: 'lttng-ust*, userspace-rcu, libbabeltrace, leveldb, liboath' - when: - - ansible_facts['pkg_mgr'] in ['yum', 'dnf'] - register: install_epel_repo - until: install_epel_repo is success - retries: 5 - delay: 2 - -- name: Copy Ceph gpg keyfile to the key location - copy: - src: "gpg/{{ item.key | basename }}" - dest: "{{ item.key }}" - mode: '0644' - with_items: "{{ ceph_gpg_keys }}" - when: - - ceph_pkg_source == 'ceph' - -- name: Install Ceph gpg keys - rpm_key: "{{ key }}" - with_items: "{{ ceph_gpg_keys }}" - loop_control: - loop_var: key - when: - - ceph_pkg_source == 'ceph' - register: _add_ceph_keys - until: _add_ceph_keys is success - retries: 5 - delay: 2 - -- 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 - priority: 50 - state: present - -- 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 - priority: 50 - state: present diff --git a/tasks/main.yml b/tasks/main.yml index eec9069..90cb23c 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -23,7 +23,7 @@ - name: Gather variables for each operating system include_vars: "{{ item }}" with_first_found: - - "{{ ansible_facts['distribution'] | lower }}-{{ ansible_dfacts['istribution_version'] | lower }}.yml" + - "{{ ansible_facts['distribution'] | lower }}-{{ ansible_facts['distribution_version'] | lower }}.yml" - "{{ ansible_facts['distribution'] | lower }}-{{ ansible_facts['distribution_major_version'] | lower }}.yml" - "{{ ansible_facts['os_family'] | lower }}-{{ ansible_facts['distribution_major_version'] | lower }}.yml" - "{{ ansible_facts['distribution'] | lower }}.yml" diff --git a/vars/suse.yml b/vars/suse.yml deleted file mode 100644 index c36e928..0000000 --- a/vars/suse.yml +++ /dev/null @@ -1,29 +0,0 @@ ---- -# Copyright 2017, SUSE LINUX GmbH. -# -# 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. - -libvirt_packages: - - qemu-kvm - -libvirt_service_name: libvirtd - -python_ceph_packages: - - "{{ (ansible_facts['distribution_version'] is version ('42', '>=')) | ternary('python-cephfs', 'python3-cephfs') }}" - - "{{ (ansible_facts['distribution_version'] is version ('42', '>=')) | ternary('python-rados', 'python3-rados') }}" - - "{{ (ansible_facts['distribution_version'] is version ('42', '>=')) | ternary('python-rbd', 'python3-rbd') }}" - - "{{ (ansible_facts['distribution_version'] is version ('42', '>=')) | ternary('python-rgw', 'python3-rgw') }}" - -# NOTE(hwoarang) Upstream does not provide openSUSE packages -# so we always set ceph_pkg_source to 'distro' for openSUSE -ceph_pkg_source: 'distro'