[Centos][rabbit upgrade] _rabbitmq_package_version is undefined

Bug #1830030 reported by kourosh vivan on 2019-05-22
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
openstack-ansible
Undecided
kourosh vivan

Bug Description

On existing centos deployment, when rerun rabbitmq playbook _rabbitmq_package_version is not defined in task (rabbitmq_server/tasks/rabbitmq_upgrade_check.yml):

- name: Compare installed version of RabbitMQ with new version variable
  fail:
    msg: "To install a new major/minor version of RabbitMQ set '-e rabbitmq_upgrade=true'."
  when:
    - not rabbitmq_upgrade | bool
    - installed_rabbitmq.rc == 0
    - not installed_rabbitmq.stdout | search(rabbitmq_package_version)
    - rabbitmq_install_method != 'distro'
  tags:
    - rabbitmq-package-deb
    - rabbitmq-package-rpm
    - rabbitmq-apt-packages

ERROR:

TASK [rabbitmq_server : Compare installed version of RabbitMQ with new version variable] **************************************************************************************************************************
fatal: [controller01_rabbit_mq_container-509aa06b]: FAILED! => {"msg": "The conditional check 'not installed_rabbitmq.stdout | search(rabbitmq_package_version)' failed. The error was: error while evaluating conditional (not installed_rabbitmq.stdout | search(rabbitmq_package_version)): '_rabbitmq_package_version' is undefined\n\nThe error appears to have been in '/etc/ansible/roles/rabbitmq_server/tasks/rabbitmq_upgrade_check.yml': line 71, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: Compare installed version of RabbitMQ with new version variable\n ^ here\n"}

grep -r _rabbitmq_package_version /etc/ansible/roles/
/etc/ansible/roles/rabbitmq_server/defaults/main.yml:rabbitmq_package_version: "{{ _rabbitmq_package_version }}"
/etc/ansible/roles/rabbitmq_server/vars/debian.yml:_rabbitmq_package_version: "{{ rabbitmq_package_url.split('/')[-2].split('_')[1] }}"
/etc/ansible/roles/rabbitmq_server/vars/gentoo.yml:_rabbitmq_package_version: ''

_rabbitmq_package_version is missing for redhat family

Add line:
 _rabbitmq_package_version: ''
in /etc/ansible/roles/rabbitmq_server/vars/redhat.yml correct this bug

Fix proposed to branch: master
Review: https://review.opendev.org/660713

Changed in openstack-ansible:
assignee: nobody → kourosh vivan (kourosh-vivan)
status: New → In Progress
Satish Patel (satish-txt) wrote :

I am getting same error on CentOS 7.6.

This patch isn't working - https://review.opendev.org/660713

Solution:

adding line in /etc/ansible/roles/rabbitmq_server/vars/redhat.yml

_rabbitmq_package_version: ''

Reviewed: https://review.opendev.org/660713
Committed: https://git.openstack.org/cgit/openstack/openstack-ansible-rabbitmq_server/commit/?id=a183b8d97e615e06b8f77c1d8a70018b6a18e9ed
Submitter: Zuul
Branch: master

commit a183b8d97e615e06b8f77c1d8a70018b6a18e9ed
Author: Kourosh Vivan <email address hidden>
Date: Wed May 22 15:16:49 2019 +0200

    Add variable causing error on rerun for redhat OS

    Add _rabbitmq_package_version for task rabbitmq_upgrade_check.yml

    Change-Id: I3fc2ab177d74202bde77d4850d6dda198e8a8de2
    Closes-Bug: 1830030

Changed in openstack-ansible:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers