diff --git a/defaults/main.yml b/defaults/main.yml index 9f5cc4aa..3649cb94 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -297,9 +297,11 @@ rabbitmq_log: rabbitmq_policies: [] rabbitmq_apply_openstack_policies: False rabbitmq_openstack_policies: - - name: "HA" - pattern: '^(?!(amq\.)|(.*_fanout_)).*' - tags: "ha-mode=all" + - name: CQv2 + pattern: '.*' + priority: 0 + tags: + queue-version: 2 rabbitmq_port_bindings: ssl_listeners: diff --git a/releasenotes/notes/rabbitmq_4-0d92471180caa8ea.yaml b/releasenotes/notes/rabbitmq_4-0d92471180caa8ea.yaml new file mode 100644 index 00000000..7bfeeeba --- /dev/null +++ b/releasenotes/notes/rabbitmq_4-0d92471180caa8ea.yaml @@ -0,0 +1,16 @@ +--- +features: + - | + RabbitMQ version is upgraded to a new major version 4.0 + +upgrade: + - | + Please, make sure you are running RabbitMQ version of 3.13 before + proceeding with the upgrade. + In case you RabbitMQ version is lower then 3.13 upgrade to 4.0 will + fail. + You can run upgrade to 3.13 with same version of role by + supplying variable ``rabbitmq_package_version`` during runtime, for + example: + ``openstack-ansible openstack.osa.rabbitmq_server -e rabbitmq_upgrade=true -e rabbitmq_package_version=3.13.7-1`` + and then re-running upgrade normally to 4.0. diff --git a/tasks/rabbitmq_upgrade_check.yml b/tasks/rabbitmq_upgrade_check.yml index e7549ab7..7e25f45e 100644 --- a/tasks/rabbitmq_upgrade_check.yml +++ b/tasks/rabbitmq_upgrade_check.yml @@ -23,7 +23,6 @@ failed_when: false register: installed_rabbitmq_deb when: - - not rabbitmq_upgrade | bool - ansible_facts['pkg_mgr'] == 'apt' tags: - rabbitmq-package-deb @@ -40,7 +39,6 @@ failed_when: false register: installed_rabbitmq_rpm when: - - not rabbitmq_upgrade | bool - ansible_facts['pkg_mgr'] == 'dnf' tags: - rabbitmq-package-rpm @@ -56,7 +54,7 @@ - "{{ installed_rabbitmq_deb }}" - "{{ installed_rabbitmq_rpm }}" -- name: Compare installed version of RabbitMQ with new version variable +- name: Ensure installed RabbitMQ version is same as expected fail: msg: "To install a new major/minor version of RabbitMQ set '-e rabbitmq_upgrade=true'." when: @@ -69,6 +67,25 @@ - rabbitmq-package-rpm - rabbitmq-apt-packages +- name: Ensure that RabbitMQ is running minimal required version for upgrade + fail: + msg: | + Minimal required version for proceeding with RabbitMQ upgrade to {{ rabbitmq_package_version }} is {{ _minimal_required_version }}. + Please, upgrade to the version {{ _minimal_required_version }} before proceeding with further upgrade. + Current detected version is {{ installed_rabbitmq.stdout }}. + vars: + _minimal_required_version: >- + {{ (_rabbitmq_upgrade_minimal_requirement_mapping | selectattr('target', 'in', rabbitmq_package_version) | first)['requirement'] }} + when: + - rabbitmq_upgrade | bool + - installed_rabbitmq.rc == 0 + - installed_rabbitmq.stdout is version(_minimal_required_version, '<') + - rabbitmq_install_method != 'distro' + tags: + - rabbitmq-package-deb + - rabbitmq-package-rpm + - rabbitmq-apt-packages + - name: Including rabbitmq_cluster_state tasks include_tasks: rabbitmq_cluster_state.yml args: diff --git a/vars/debian.yml b/vars/debian.yml index 2c75b007..0f9f0f9a 100644 --- a/vars/debian.yml +++ b/vars/debian.yml @@ -14,7 +14,7 @@ # limitations under the License. _rabbitmq_install_method: external_repo -_rabbitmq_package_version: "3.13.7-1" +_rabbitmq_package_version: "4.0.3-1" _rabbitmq_erlang_package_version: "26.2.*-1" _rabbitmq_repo_url: "https://ppa1.rabbitmq.com/rabbitmq/rabbitmq-server/deb/{{ ansible_facts['distribution'] | lower }}" diff --git a/vars/main.yml b/vars/main.yml index 8687cbd6..058228d2 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -22,3 +22,15 @@ _rabbitmq_is_last_play_host: >- {{ (inventory_hostname == (groups[rabbitmq_host_group] | intersect(ansible_play_hosts)) | last) | bool }} + +_rabbitmq_upgrade_minimal_requirement_mapping: + - target: "4.0" + requirement: "3.13" + - target: "3.13" + requirement: "3.11" + - target: "3.12" + requirement: "3.11" + - target: "3.11" + requirement: "3.10" + - target: "3.10" + requirement: "3.7" diff --git a/vars/redhat.yml b/vars/redhat.yml index a11be908..329b0407 100644 --- a/vars/redhat.yml +++ b/vars/redhat.yml @@ -14,7 +14,7 @@ # limitations under the License. _rabbitmq_install_method: external_repo -_rabbitmq_package_version: "3.13.7-1" +_rabbitmq_package_version: "4.0.3-1" # NOTE(nhanlon) 2023-05-30: although the package repository is marked # el9, the packages themselves still have an el8 dist tag for rabbitmq _rabbitmq_package_dist_tag: "el8"