From 7909778d0ec3dd8cd028fedeb953df7b004a5138 Mon Sep 17 00:00:00 2001 From: Guillaume Abrioux Date: Fri, 2 Jun 2023 11:34:15 +0200 Subject: [PATCH] add CentOS stream 9 support This adds the resquired changes in order to support CentOS stream 9. Also, this bumps the Ansible version support to 2.15 Signed-off-by: Guillaume Abrioux --- .github/workflows/ansible-lint.yml | 2 +- ceph-ansible.spec.in | 4 +-- dashboard.yml | 25 +++++++++++-------- infrastructure-playbooks/purge-cluster.yml | 8 ------ infrastructure-playbooks/rolling_update.yml | 11 +++++--- requirements.txt | 2 +- roles/ceph-container-engine/vars/CentOS-9.yml | 3 +++ roles/ceph-facts/tasks/container_binary.yml | 4 +-- roles/ceph-infra/tasks/configure_firewall.yml | 2 -- roles/ceph-validate/tasks/check_system.yml | 4 +-- site-container.yml.sample | 6 ++--- site.yml.sample | 4 +-- tests/requirements.txt | 2 +- tox-cephadm.ini | 2 +- tox-external_clients.ini | 4 +-- tox-podman.ini | 2 +- tox-rbdmirror.ini | 4 +-- tox-shrink_osd.ini | 4 +-- tox-subset_update.ini | 4 +-- tox-update.ini | 4 +-- tox.ini | 4 +-- 21 files changed, 52 insertions(+), 53 deletions(-) create mode 100644 roles/ceph-container-engine/vars/CentOS-9.yml diff --git a/.github/workflows/ansible-lint.yml b/.github/workflows/ansible-lint.yml index d4994387e..9a8b4962a 100644 --- a/.github/workflows/ansible-lint.yml +++ b/.github/workflows/ansible-lint.yml @@ -10,7 +10,7 @@ jobs: with: python-version: '3.8' architecture: x64 - - run: pip install -r <(grep ansible tests/requirements.txt) ansible-lint==4.3.7 'rich>=9.5.1,<11.0.0' netaddr + - run: pip install -r <(grep ansible tests/requirements.txt) ansible-lint==6.16.0 netaddr - run: ansible-galaxy install -r requirements.yml - run: ansible-lint -x 106,204,205,208 -v --force-color ./roles/*/ ./infrastructure-playbooks/*.yml site-container.yml.sample site-container.yml.sample dashboard.yml - run: ansible-playbook -i ./tests/functional/all_daemons/hosts site.yml.sample --syntax-check --list-tasks -vv diff --git a/ceph-ansible.spec.in b/ceph-ansible.spec.in index fbfa40055..fd53c0156 100644 --- a/ceph-ansible.spec.in +++ b/ceph-ansible.spec.in @@ -15,8 +15,8 @@ Obsoletes: ceph-iscsi-ansible <= 1.5 BuildArch: noarch -BuildRequires: ansible >= 2.9 -Requires: ansible >= 2.9 +BuildRequires: ansible-core >= 2.14 +Requires: ansible-core >= 2.14 %if 0%{?rhel} == 7 BuildRequires: python2-devel diff --git a/dashboard.yml b/dashboard.yml index 6ebec6d20..13624728a 100644 --- a/dashboard.yml +++ b/dashboard.yml @@ -12,6 +12,10 @@ gather_facts: false become: true pre_tasks: + - import_role: + name: ceph-defaults + tags: ['ceph_update_config'] + - name: set ceph node exporter install 'In Progress' run_once: true set_stats: @@ -21,9 +25,6 @@ start: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}" tasks: - - import_role: - name: ceph-defaults - tags: ['ceph_update_config'] - import_role: name: ceph-facts tags: ['ceph_update_config'] @@ -47,10 +48,14 @@ status: "Complete" end: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}" -- hosts: "{{ monitoring_group_name }}" +- hosts: "{{ monitoring_group_name | default('monitoring') }}" gather_facts: false become: true pre_tasks: + - import_role: + name: ceph-defaults + tags: ['ceph_update_config'] + - name: set ceph grafana install 'In Progress' run_once: true set_stats: @@ -60,9 +65,6 @@ start: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}" tasks: - - import_role: - name: ceph-defaults - tags: ['ceph_update_config'] - import_role: name: ceph-facts tags: ['ceph_update_config'] @@ -86,10 +88,14 @@ # using groups[] here otherwise it can't fallback to the mon if there's no mgr group. # adding an additional | default(omit) in case where no monitors are present (external ceph cluster) -- hosts: "{{ groups[mgr_group_name] | default(groups[mon_group_name]) | default(omit) }}" +- hosts: "{{ groups[mgr_group_name|default('mgrs')] | default(groups[mon_group_name|default('mons')]) | default(omit) }}" gather_facts: false become: true pre_tasks: + - import_role: + name: ceph-defaults + tags: ['ceph_update_config'] + - name: set ceph dashboard install 'In Progress' run_once: true set_stats: @@ -99,9 +105,6 @@ start: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}" tasks: - - import_role: - name: ceph-defaults - tags: ['ceph_update_config'] - import_role: name: ceph-facts tags: ['ceph_update_config'] diff --git a/infrastructure-playbooks/purge-cluster.yml b/infrastructure-playbooks/purge-cluster.yml index c992f9468..747ecbc91 100644 --- a/infrastructure-playbooks/purge-cluster.yml +++ b/infrastructure-playbooks/purge-cluster.yml @@ -1000,13 +1000,9 @@ - name: remove package dependencies on redhat command: yum -y autoremove - args: - warn: no - name: remove package dependencies on redhat again command: yum -y autoremove - args: - warn: no when: ansible_facts['pkg_mgr'] == "yum" @@ -1019,13 +1015,9 @@ - name: remove package dependencies on redhat command: dnf -y autoremove - args: - warn: no - name: remove package dependencies on redhat again command: dnf -y autoremove - args: - warn: no when: ansible_facts['pkg_mgr'] == "dnf" when: diff --git a/infrastructure-playbooks/rolling_update.yml b/infrastructure-playbooks/rolling_update.yml index 198a8316a..b6e4c097d 100644 --- a/infrastructure-playbooks/rolling_update.yml +++ b/infrastructure-playbooks/rolling_update.yml @@ -148,6 +148,8 @@ become: True gather_facts: false tasks: + - import_role: + name: ceph-defaults - name: upgrade ceph mon cluster block: - name: remove ceph aliases @@ -169,8 +171,6 @@ set_fact: mon_host: "{{ groups[mon_group_name] | difference([inventory_hostname]) | last }}" - - import_role: - name: ceph-defaults - import_role: name: ceph-facts @@ -305,6 +305,9 @@ delay: "{{ health_mon_check_delay }}" when: containerized_deployment | bool rescue: + - import_role: + name: ceph-defaults + - name: unmask the mon service systemd: name: ceph-mon@{{ ansible_facts['hostname'] }} @@ -1112,7 +1115,7 @@ name: ceph-node-exporter - name: upgrade monitoring node - hosts: "{{ monitoring_group_name }}" + hosts: "{{ monitoring_group_name|default('monitoring') }}" tags: monitoring gather_facts: false become: true @@ -1144,7 +1147,7 @@ name: ceph-grafana - name: upgrade ceph dashboard - hosts: "{{ groups[mgr_group_name] | default(groups[mon_group_name]) | default(omit) }}" + hosts: "{{ groups[mgr_group_name|default('mgrs')] | default(groups[mon_group_name|default('mons')]) | default(omit) }}" tags: monitoring gather_facts: false become: true diff --git a/requirements.txt b/requirements.txt index 4ed60d62d..2148d6058 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ # These are Python requirements needed to run ceph-ansible main -ansible-core>=2.12,<2.13 +ansible-core>=2.14,<2.15,!=2.9.10 netaddr six diff --git a/roles/ceph-container-engine/vars/CentOS-9.yml b/roles/ceph-container-engine/vars/CentOS-9.yml new file mode 100644 index 000000000..a46ed44fb --- /dev/null +++ b/roles/ceph-container-engine/vars/CentOS-9.yml @@ -0,0 +1,3 @@ +--- +container_package_name: podman +container_service_name: podman diff --git a/roles/ceph-facts/tasks/container_binary.yml b/roles/ceph-facts/tasks/container_binary.yml index 0054f7848..e41c24017 100644 --- a/roles/ceph-facts/tasks/container_binary.yml +++ b/roles/ceph-facts/tasks/container_binary.yml @@ -6,5 +6,5 @@ - name: set_fact container_binary set_fact: - container_binary: "{{ 'podman' if (podman_binary.stat.exists and ansible_facts['distribution'] == 'Fedora') or (ansible_facts['os_family'] == 'RedHat' and ansible_facts['distribution_major_version'] == '8') else 'docker' }}" - when: not docker2podman | default(false) | bool \ No newline at end of file + container_binary: "{{ 'podman' if (podman_binary.stat.exists and ansible_facts['distribution'] == 'Fedora') or (ansible_facts['os_family'] == 'RedHat' and ansible_facts['distribution_major_version'] in ['8', '9']) else 'docker' }}" + when: not docker2podman | default(false) | bool diff --git a/roles/ceph-infra/tasks/configure_firewall.yml b/roles/ceph-infra/tasks/configure_firewall.yml index 54dbc4ffd..7469584bf 100644 --- a/roles/ceph-infra/tasks/configure_firewall.yml +++ b/roles/ceph-infra/tasks/configure_firewall.yml @@ -1,8 +1,6 @@ --- - name: check firewalld installation on redhat or SUSE/openSUSE command: rpm -q firewalld - args: - warn: no register: firewalld_pkg_query ignore_errors: true check_mode: no diff --git a/roles/ceph-validate/tasks/check_system.yml b/roles/ceph-validate/tasks/check_system.yml index d40453024..fb4513a1e 100644 --- a/roles/ceph-validate/tasks/check_system.yml +++ b/roles/ceph-validate/tasks/check_system.yml @@ -6,8 +6,8 @@ - name: fail on unsupported ansible version fail: - msg: "Ansible version must be 2.12!" - when: ansible_version.minor|int != 12 + msg: "Ansible version must be 2.14!" + when: ansible_version.minor|int != 14 - name: fail on unsupported system fail: diff --git a/site-container.yml.sample b/site-container.yml.sample index d552084ce..b3b48fa39 100644 --- a/site-container.yml.sample +++ b/site-container.yml.sample @@ -34,6 +34,8 @@ tasks: # pre-tasks for following import - + - import_role: + name: ceph-defaults - name: gather facts setup: gather_subset: @@ -56,8 +58,6 @@ when: delegate_facts_host | bool tags: always - - import_role: - name: ceph-defaults # dummy container setup is only supported on x86_64 # when running with containerized_deployment: true this task @@ -503,7 +503,7 @@ - name: set_fact container_binary set_fact: - container_binary: "{{ 'podman' if (podman_binary.stat.exists and ansible_facts['distribution'] == 'Fedora') or (ansible_facts['os_family'] == 'RedHat' and ansible_facts['distribution_major_version'] == '8') else 'docker' }}" + container_binary: "{{ 'podman' if (podman_binary.stat.exists and ansible_facts['distribution'] == 'Fedora') or (ansible_facts['os_family'] == 'RedHat' and ansible_facts['distribution_major_version'] in ['8', '9']) else 'docker' }}" - name: get ceph status from the first monitor command: > diff --git a/site.yml.sample b/site.yml.sample index 3b66683e5..26a3aa3fe 100644 --- a/site.yml.sample +++ b/site.yml.sample @@ -34,6 +34,8 @@ delegate_facts_host: True pre_tasks: + - import_role: + name: ceph-defaults # If we can't get python2 installed before any module is used we will fail # so just try what we can to get it installed @@ -61,8 +63,6 @@ when: delegate_facts_host | bool tasks: - - import_role: - name: ceph-defaults # dummy container setup is only supported on x86_64 # when running with containerized_deployment: true this task diff --git a/tests/requirements.txt b/tests/requirements.txt index 2ed780f6d..2e55bd36f 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -2,7 +2,7 @@ pytest-testinfra pytest-xdist pytest -ansible-core>=2.12,<2.13,!=2.9.10 +ansible-core>=2.14,<2.15,!=2.9.10 Jinja2>=2.10 netaddr mock diff --git a/tox-cephadm.ini b/tox-cephadm.ini index 2124856d9..3e0f398d6 100644 --- a/tox-cephadm.ini +++ b/tox-cephadm.ini @@ -22,7 +22,7 @@ setenv= # only available for ansible >= 2.5 ANSIBLE_STDOUT_CALLBACK = yaml # Set the vagrant box image to use - CEPH_ANSIBLE_VAGRANT_BOX = centos/stream8 + CEPH_ANSIBLE_VAGRANT_BOX = centos/stream9 deps= -r{toxinidir}/tests/requirements.txt changedir= {toxinidir}/tests/functional/cephadm diff --git a/tox-external_clients.ini b/tox-external_clients.ini index ad26974a4..dc3ce4950 100644 --- a/tox-external_clients.ini +++ b/tox-external_clients.ini @@ -21,8 +21,8 @@ setenv= ANSIBLE_STDOUT_CALLBACK = yaml # non_container: DEV_SETUP = True # Set the vagrant box image to use - centos-non_container: CEPH_ANSIBLE_VAGRANT_BOX = centos/stream8 - centos-container: CEPH_ANSIBLE_VAGRANT_BOX = centos/stream8 + centos-non_container: CEPH_ANSIBLE_VAGRANT_BOX = centos/stream9 + centos-container: CEPH_ANSIBLE_VAGRANT_BOX = centos/stream9 container: CONTAINER_DIR = /container container: PLAYBOOK = site-container.yml.sample diff --git a/tox-podman.ini b/tox-podman.ini index 08546d4c9..cb1491444 100644 --- a/tox-podman.ini +++ b/tox-podman.ini @@ -22,7 +22,7 @@ setenv= # only available for ansible >= 2.5 ANSIBLE_STDOUT_CALLBACK = yaml # Set the vagrant box image to use - CEPH_ANSIBLE_VAGRANT_BOX = centos/stream8 + CEPH_ANSIBLE_VAGRANT_BOX = centos/stream9 # Set the ansible inventory host file to be used according to which distrib we are running on INVENTORY = {env:_INVENTORY:hosts} diff --git a/tox-rbdmirror.ini b/tox-rbdmirror.ini index aaa61d1f1..84328a710 100644 --- a/tox-rbdmirror.ini +++ b/tox-rbdmirror.ini @@ -21,8 +21,8 @@ setenv= ANSIBLE_STDOUT_CALLBACK = yaml # non_container: DEV_SETUP = True # Set the vagrant box image to use - centos-non_container: CEPH_ANSIBLE_VAGRANT_BOX = centos/stream8 - centos-container: CEPH_ANSIBLE_VAGRANT_BOX = centos/stream8 + centos-non_container: CEPH_ANSIBLE_VAGRANT_BOX = centos/stream9 + centos-container: CEPH_ANSIBLE_VAGRANT_BOX = centos/stream9 INVENTORY = {env:_INVENTORY:hosts} container: CONTAINER_DIR = /container diff --git a/tox-shrink_osd.ini b/tox-shrink_osd.ini index d5478362e..6e4001999 100644 --- a/tox-shrink_osd.ini +++ b/tox-shrink_osd.ini @@ -62,8 +62,8 @@ setenv= ANSIBLE_STDOUT_CALLBACK = yaml non_container: DEV_SETUP = True # Set the vagrant box image to use - centos-non_container: CEPH_ANSIBLE_VAGRANT_BOX = centos/stream8 - centos-container: CEPH_ANSIBLE_VAGRANT_BOX = centos/stream8 + centos-non_container: CEPH_ANSIBLE_VAGRANT_BOX = centos/stream9 + centos-container: CEPH_ANSIBLE_VAGRANT_BOX = centos/stream9 INVENTORY = {env:_INVENTORY:hosts} container: CONTAINER_DIR = /container container: PLAYBOOK = site-container.yml.sample diff --git a/tox-subset_update.ini b/tox-subset_update.ini index 17dffea10..a5b556e5c 100644 --- a/tox-subset_update.ini +++ b/tox-subset_update.ini @@ -21,8 +21,8 @@ setenv= ANSIBLE_STDOUT_CALLBACK = yaml # non_container: DEV_SETUP = True # Set the vagrant box image to use - centos-non_container: CEPH_ANSIBLE_VAGRANT_BOX = centos/stream8 - centos-container: CEPH_ANSIBLE_VAGRANT_BOX = centos/stream8 + centos-non_container: CEPH_ANSIBLE_VAGRANT_BOX = centos/stream9 + centos-container: CEPH_ANSIBLE_VAGRANT_BOX = centos/stream9 INVENTORY = {env:_INVENTORY:hosts} container: CONTAINER_DIR = /container diff --git a/tox-update.ini b/tox-update.ini index 77771026c..9e74b141a 100644 --- a/tox-update.ini +++ b/tox-update.ini @@ -21,8 +21,8 @@ setenv= ANSIBLE_STDOUT_CALLBACK = yaml # non_container: DEV_SETUP = True # Set the vagrant box image to use - centos-non_container: CEPH_ANSIBLE_VAGRANT_BOX = centos/stream8 - centos-container: CEPH_ANSIBLE_VAGRANT_BOX = centos/stream8 + centos-non_container: CEPH_ANSIBLE_VAGRANT_BOX = centos/stream9 + centos-container: CEPH_ANSIBLE_VAGRANT_BOX = centos/stream9 INVENTORY = {env:_INVENTORY:hosts} container: CONTAINER_DIR = /container diff --git a/tox.ini b/tox.ini index 679214c31..9934963f2 100644 --- a/tox.ini +++ b/tox.ini @@ -313,8 +313,8 @@ setenv= ANSIBLE_STDOUT_CALLBACK = yaml non_container: DEV_SETUP = True # Set the vagrant box image to use - centos-non_container: CEPH_ANSIBLE_VAGRANT_BOX = centos/stream8 - centos-container: CEPH_ANSIBLE_VAGRANT_BOX = centos/stream8 + centos-non_container: CEPH_ANSIBLE_VAGRANT_BOX = centos/stream9 + centos-container: CEPH_ANSIBLE_VAGRANT_BOX = centos/stream9 INVENTORY = {env:_INVENTORY:hosts} container: CONTAINER_DIR = /container container: PLAYBOOK = site-container.yml.sample -- 2.47.3