9f95b25476
The dnf package manager was missing from the list of package managers in the upgrade check tasks. This patch ensures that the upgrade check runs on servers with dnf. The dnf module has no 'update_cache' argument, so this patch removes that if dnf is being used. Updating the metadata cache is not needed. Implements: blueprint centos-and-dnf Change-Id: I10565b2e9379d5ac60ae65bfcdda221a0218988e
74 lines
2.3 KiB
YAML
74 lines
2.3 KiB
YAML
---
|
|
# Copyright 2015, Rackspace US, Inc.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
|
|
# ansible-lint fails on this task due to the detected use of 'dpkg',
|
|
# 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"
|
|
failed_when: false
|
|
register: installed_rabbitmq_deb
|
|
when:
|
|
- not rabbitmq_upgrade | bool
|
|
- ansible_pkg_mgr == 'apt'
|
|
tags:
|
|
- rabbitmq-package-deb
|
|
- rabbitmq-apt-packages
|
|
- skip_ansible_lint
|
|
|
|
# ansible-lint fails on this task due to the detected use of 'rpm',
|
|
# 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"
|
|
args:
|
|
warn: no
|
|
failed_when: false
|
|
register: installed_rabbitmq_rpm
|
|
when:
|
|
- not rabbitmq_upgrade | bool
|
|
- ansible_pkg_mgr in ['yum', 'dnf', 'zypper']
|
|
tags:
|
|
- rabbitmq-package-rpm
|
|
- rabbitmq-yum-packages
|
|
- rabbitmq-zypper-packages
|
|
- skip_ansible_lint
|
|
|
|
- name: Register a fact for the installed RabbitMQ version
|
|
set_fact:
|
|
installed_rabbitmq: "{{ item }}"
|
|
when:
|
|
- not item | skipped
|
|
- item | changed
|
|
with_items:
|
|
- "{{ installed_rabbitmq_deb }}"
|
|
- "{{ installed_rabbitmq_rpm }}"
|
|
|
|
- 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)
|
|
tags:
|
|
- rabbitmq-package-deb
|
|
- rabbitmq-package-rpm
|
|
- rabbitmq-apt-packages
|
|
|
|
- include: rabbitmq_upgrade_prep.yml
|
|
static: no
|
|
when: rabbitmq_upgrade | bool
|