diff --git a/defaults/main.yml b/defaults/main.yml index 38d0827..a432162 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -42,6 +42,10 @@ ceph_pkg_source: ceph ceph_stable_release: reef ceph_apt_pinned_packages: [{package: "*", release: "ceph.com", priority: 1001}] +ceph_repo_url_region: "download" # see here for other mirros http://docs.ceph.com/docs/master/install/mirrors/ +ceph_repo_url: https://{{ ceph_repo_url_region }}.ceph.com/{{ _ceph_repo_distro_suffix }}-{{ ceph_stable_release }} +ceph_repos: "{{ _ceph_repos }}" + # Ceph Authentication cephx: true diff --git a/releasenotes/notes/align_ceph_repo_vars-222f6af6a7d349a2.yaml b/releasenotes/notes/align_ceph_repo_vars-222f6af6a7d349a2.yaml new file mode 100644 index 0000000..793dd0e --- /dev/null +++ b/releasenotes/notes/align_ceph_repo_vars-222f6af6a7d349a2.yaml @@ -0,0 +1,18 @@ +--- +upgrade: + - | + The configuration of repositories for the ceph_client role through + the `ceph_yum_repo_url` and `ceph_repo_url` variable is changed. + These variables were replaced by unified `ceph_repo_url` variable. + With that `ceph_apt_repos` has bee replaced by `ceph_repos` variable + which should follow deb822_repository format for Debian/Ubuntu and + `yum_repository` for CentOS Stream/Rocky Linux. + +deprecations: + - | + In order to unify Ceph client installation approaches for EL and Debian + platforms following variables were deprecated and are silently ignored: + + * ceph_yum_repo_url + * ceph_apt_repo_url + * ceph_apt_repos diff --git a/tasks/ceph_preinstall_apt.yml b/tasks/ceph_preinstall_apt.yml index 3878854..3df6c49 100644 --- a/tasks/ceph_preinstall_apt.yml +++ b/tasks/ceph_preinstall_apt.yml @@ -15,7 +15,7 @@ - name: Validate repo config is deb822 format vars: - _repo_check: "{{ ceph_apt_repos.values() | selectattr('repo', 'defined') | map(attribute='repo') }}" + _repo_check: "{{ ceph_repos | selectattr('repo', 'defined') | map(attribute='repo') }}" ansible.builtin.assert: that: _repo_check | length == 0 fail_msg: "The following repository definitions must be updated to deb822 format {{ _repo_check }}" @@ -24,7 +24,7 @@ - name: Find legacy repository files find: paths: /etc/apt/sources.list.d/ - patterns: "{{ ceph_apt_repo_url | urlsplit('hostname') | replace('.', '_') }}_*.list" + patterns: "{{ ceph_repo_url | urlsplit('hostname') | replace('.', '_') }}_*.list" register: _legacy_apt_repos - name: Clean up legacy repository config not in deb822 format @@ -70,7 +70,7 @@ trusted: "{{ item.trusted | default(omit) }}" types: "{{ item.types | default(omit) }}" uris: "{{ item.uris | default(omit) }}" - loop: "{{ ceph_apt_repos.values() }}" + loop: "{{ ceph_repos }}" loop_control: label: "{{ loop_label | to_json }}" register: deb822_repos diff --git a/tasks/ceph_preinstall_dnf.yml b/tasks/ceph_preinstall_dnf.yml index 72c816e..ddd0dca 100644 --- a/tasks/ceph_preinstall_dnf.yml +++ b/tasks/ceph_preinstall_dnf.yml @@ -15,42 +15,23 @@ - name: Download EPEL gpg keys get_url: - url: "{{ ceph_centos_epel_key }}" - dest: /etc/pki/rpm-gpg + url: "{{ item.url }}" + dest: "{{ item.key }}" mode: "0640" + with_items: "{{ ceph_gpg_keys | selectattr('url', 'defined') }}" register: _get_yum_keys until: _get_yum_keys is success retries: 5 delay: 2 - -- name: Install EPEL gpg keys - rpm_key: - key: "/etc/pki/rpm-gpg/{{ ceph_centos_epel_key.split('/')[-1] }}" - state: present - -- name: Install the EPEL repository - yum_repository: - name: ceph-client-deps - baseurl: "{{ ceph_centos_epel_mirror ~ '/' ~ ansible_facts['distribution_major_version'] ~ '/Everything/' ~ ansible_facts['architecture'] }}" - description: "Extra Packages for Enterprise Linux {{ ansible_facts['distribution_major_version'] }} - $basearch" - gpgcheck: yes - gpgkey: "file:///etc/pki/rpm-gpg/{{ ceph_centos_epel_key.split('/')[-1] }}" - enabled: yes - state: present - includepkgs: 'lttng-ust*, userspace-rcu, libbabeltrace, leveldb, liboath, fmt, thrift' when: - - ansible_facts['pkg_mgr'] == 'dnf' - register: install_epel_repo - until: install_epel_repo is success - retries: 5 - delay: 2 + - ceph_pkg_source == 'ceph' - name: Copy Ceph gpg keyfile to the key location copy: - src: "gpg/{{ item.key | basename }}" + src: "{{ item.src }}" dest: "{{ item.key }}" - mode: '0644' - with_items: "{{ ceph_gpg_keys }}" + mode: "0640" + with_items: "{{ ceph_gpg_keys | selectattr('src', 'defined') }}" when: - ceph_pkg_source == 'ceph' @@ -69,24 +50,22 @@ retries: 5 delay: 2 -- name: Add ceph repo +- name: Install required repositories 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 + baseurl: "{{ item.baseurl }}" + description: "{{ item.description | default(omit) }}" + enabled: "{{ item.enabled | default(True) }}" + file: "{{ item.file | default(omit) }}" + includepkgs: "{{ item.includepkgs | default(omit) }}" + gpgcheck: "{{ item.gpgcheck | default(omit) }}" + gpgkey: "{{ item.gpgkey | default(omit) }}" + name: "{{ item.name }}" + priority: "{{ item.priority | default(omit) }}" + state: "{{ item.enabled | default('present') }}" + with_items: "{{ ceph_repos }}" + when: + - ansible_facts['pkg_mgr'] == 'dnf' + register: install_repo + until: install_repo is success + retries: 5 + delay: 2 diff --git a/vars/debian.yml b/vars/debian.yml index 82097f6..1efb354 100644 --- a/vars/debian.yml +++ b/vars/debian.yml @@ -17,9 +17,6 @@ ## APT Cache Options cache_timeout: 600 -# Ceph.com repository variables -ceph_apt_repo_url_region: "download" # or "eu" for Netherlands based mirror -ceph_apt_repo_url: "http://{{ ceph_apt_repo_url_region }}.ceph.com/debian-{{ ceph_stable_release }}" libvirt_packages: - libvirt-daemon-system @@ -32,12 +29,11 @@ python_ceph_packages: - python3-rados - python3-rbd -# Apt repositories -ceph_apt_repos: - ceph: - name: "Ceph" +_ceph_repo_distro_suffix: debian +_ceph_repos: + - name: "ceph" suites: "{{ ansible_facts['distribution_release'] }}" - uris: "{{ ceph_apt_repo_url }}" + uris: "{{ ceph_repo_url }}" signed_by: "{{ lookup('file', 'gpg/460f3994') }}" components: main architectures: "{{ ansible_facts['architecture'] }}" diff --git a/vars/redhat.yml b/vars/redhat.yml index e3ab1b8..7fdc8c8 100644 --- a/vars/redhat.yml +++ b/vars/redhat.yml @@ -17,6 +17,11 @@ ceph_gpg_keys: # download.ceph.com/keys/release.asc - key: /etc/pki/rpm-gpg/ceph_com_keys_release + src: gpg/ceph_com_keys_release + state: "{{ (ceph_pkg_source == 'ceph') | ternary('present', 'absent') }}" + - key: "/etc/pki/rpm-gpg/{{ ceph_centos_epel_key | basename }}" + url: "{{ ceph_centos_epel_key }}" + state: "{{ (ceph_pkg_source == 'ceph') | ternary('present', 'absent') }}" libvirt_packages: - libvirt-daemon-kvm @@ -29,7 +34,31 @@ python_ceph_packages: - python3-rados - python3-rbd -ceph_repo_url_region: "download" # see here for other mirros http://docs.ceph.com/docs/master/install/mirrors/ -ceph_yum_repo_url: "https://{{ ceph_repo_url_region }}.ceph.com/rpm-{{ ceph_stable_release }}/el{{ ansible_facts['distribution_major_version'] }}" +_ceph_repo_distro_suffix: rpm +_ceph_repos: + - name: ceph-client-deps + baseurl: "{{ ceph_centos_epel_mirror ~ '/' ~ ansible_facts['distribution_major_version'] ~ '/Everything/' ~ ansible_facts['architecture'] }}" + description: "Extra Packages for Enterprise Linux {{ ansible_facts['distribution_major_version'] }} - $basearch" + gpgcheck: yes + gpgkey: "file:///etc/pki/rpm-gpg/{{ ceph_centos_epel_key.split('/')[-1] }}" + enabled: yes + state: "{{ (ceph_pkg_source == 'ceph') | ternary('present', 'absent') }}" + includepkgs: 'lttng-ust*, userspace-rcu, libbabeltrace, leveldb, liboath, fmt, thrift' + - name: ceph + description: "Ceph packages for $basearch" + file: ceph + baseurl: "{{ ceph_yum_repo_url }}/el$releasever/$basearch" + gpgcheck: yes + enabled: yes + priority: 50 + state: "{{ (ceph_pkg_source == 'ceph') | ternary('present', 'absent') }}" + - name: ceph-noarch + description: "Ceph noarch packages" + file: ceph + baseurl: "{{ ceph_yum_repo_url }}/el$releasever/noarch" + gpgcheck: yes + enabled: yes + priority: 50 + state: "{{ (ceph_pkg_source == 'ceph') | ternary('present', 'absent') }}" # TODO mgariepy: add CentOS SIG ceph repo.