9dccd87218
The openSUSE OBS OpenStack repositories provide rabbitmq-server and erlang packages tested in an openSUSE OpenStack cloud environment so it's best to use these instead of upstream ones. As such we change the default option to be 'distro' instead of 'file'. However, for the tests we use 'file' so we can install an older version and test the upgrade path. Moreover, we drop the 'zypper lock' code since the OBS repositories only provide one version of the needed packages. Finally, we fail if the installation method is set to external since there is no upstream repositoiry for openSUSE. Change-Id: I79b8f0af97b6fcbf904f4b497a8ab0e070d20542
103 lines
3.6 KiB
YAML
103 lines
3.6 KiB
YAML
---
|
|
# Copyright 2017, SUSE LINUX GmbH.
|
|
#
|
|
# 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.
|
|
|
|
- name: Fail if installation method is set to 'external_repo' on openSUSE
|
|
fail:
|
|
msg: "rabbitmq_install_method='external_repo' is not supported on openSUSE"
|
|
when: rabbitmq_install_method == 'external_repo'
|
|
|
|
- block:
|
|
- name: Add rabbitmq gpg-keys
|
|
rpm_key:
|
|
state: present
|
|
key: "{{ item.keyserver }}/{{ item.key_name }}"
|
|
register: add_keys
|
|
until: add_keys | success
|
|
retries: 5
|
|
delay: 2
|
|
with_items: "{{ rabbitmq_gpg_keys }}"
|
|
tags:
|
|
- rabbitmq-gpg-keys
|
|
|
|
rescue:
|
|
- name: Add rabbitmq gpg-keys using fallback keyserver
|
|
rpm_key:
|
|
state: present
|
|
key: "{{ item.fallback_keyserver }}/{{ item.key_name }}"
|
|
register: add_keys_fallback
|
|
until: add_keys_fallback | success
|
|
retries: 5
|
|
delay: 2
|
|
with_items: "{{ rabbitmq_gpg_keys }}"
|
|
when:
|
|
- item.fallback_keyserver is defined
|
|
tags:
|
|
- rabbitmq-gpg-keys
|
|
when: rabbitmq_install_method != 'distro'
|
|
|
|
# NOTE(hwoarang) For the upgrade job we fetch the old version from upstream and the new one from OBS. zypper gets upset if you
|
|
# get the updaded package during an update so you need to pass --force to actually force such a change. However, --force forces a
|
|
# re-install independent of repo changes but it's not the end of the world.
|
|
- name: Install the RabbitMQ package RPM
|
|
zypper:
|
|
name: "{{ rabbitmq_package_path }}"
|
|
state: "{{ rabbitmq_package_state }}"
|
|
register: install_rabbitmq
|
|
tags:
|
|
- rabbitmq-package-rpm
|
|
- rabbitmq-zypper-packages
|
|
when: rabbitmq_install_method == 'file'
|
|
|
|
- block:
|
|
- name: Install the RabbitMQ package
|
|
zypper:
|
|
name: "{{ rabbitmq_distro_packages }}"
|
|
state: "{{ rabbitmq_package_state }}"
|
|
register: install_rabbitmq
|
|
rescue:
|
|
- name: Install the RabbitMQ package (force)
|
|
package:
|
|
name: "{{ rabbitmq_distro_packages }}"
|
|
state: "{{ rabbitmq_package_state }}"
|
|
force: yes
|
|
register: install_rabbitmq
|
|
tags:
|
|
- rabbitmq-package-rpm
|
|
- rabbitmq-zypper-packages
|
|
when: rabbitmq_install_method == 'distro'
|
|
|
|
# NOTE(hwoarang) on openSUSE, rabbitmq-server depends on epmd.service which
|
|
# depends on epmd.socket which runs on localhost. It is just easier to let
|
|
# the rabbitmq-server launch epmd directly since we are inside a container.
|
|
- name: Add rabbitmq-server systemd service (SUSE)
|
|
template:
|
|
src: "rabbitmq-server.service.j2"
|
|
dest: "/etc/systemd/system/rabbitmq-server.service"
|
|
register: rabbitmq_server_service_added
|
|
# NOTE(hwoarang) Normally, this task should only be executed when
|
|
# rabbitmq_install_method == 'distro'. However, the upstream package
|
|
# does not contain a systemd file and as such we need to provide one.
|
|
# This should be reverted once https://github.com/rabbitmq/rabbitmq-server-release/pull/31
|
|
# is merged and new builds of rabbimq-server are available.
|
|
tags:
|
|
- rabbitmq-config
|
|
|
|
- name: Reload the systemd daemon
|
|
command: "systemctl daemon-reload"
|
|
when:
|
|
- rabbitmq_server_service_added | changed
|
|
tags:
|
|
- rabbitmq-config
|