Replace shell with simple command for version verification

There is no need in using complicated shell for getting/grepping
for instaled rabbitmq version as this can be done in more neat way
with simple commad.

Alternative would be to gather package facts, but we may want not to
rely on facts caching and leave quering package managers.

Change-Id: Ieb858a7e850ec6b48989196392fb85a4b3c2a8a7
This commit is contained in:
Dmitriy Rabotyagov 2022-04-13 13:42:16 +02:00 committed by Dmitriy Rabotyagov
parent 8316e00cf0
commit dceda157fa

@ -17,7 +17,7 @@
# so we skip this task in the ansible-lint check by using the
# 'skip_ansible_lint' tag
- name: Get version of installed RabbitMQ package (deb)
shell: "dpkg -l | grep rabbitmq-server"
command: "dpkg-query -W rabbitmq-server"
changed_when: false
check_mode: false
failed_when: false
@ -34,7 +34,7 @@
# so we skip this task in the ansible-lint check by using the
# 'skip_ansible_lint' tag
- name: Get version of installed RabbitMQ package (rpm)
shell: "rpm -qa | grep rabbitmq-server"
command: "rpm -q rabbitmq-server"
args:
warn: no
changed_when: false