SUSE: Use rabbitmq-server/erlang packages from openSUSE repos

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
This commit is contained in:
Markos Chandras 2017-09-08 14:58:37 +01:00 committed by Markos Chandras (hwoarang)
parent a74c237cf7
commit 9dccd87218
4 changed files with 44 additions and 31 deletions

View File

@ -13,6 +13,11 @@
# 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:
@ -40,34 +45,38 @@
- item.fallback_keyserver is defined
tags:
- rabbitmq-gpg-keys
when: rabbitmq_install_method != 'distro'
- name: Install RabbitMQ package dependencies
# 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: "{{ item }}"
name: "{{ rabbitmq_package_path }}"
state: "{{ rabbitmq_package_state }}"
update_cache: yes
register: install_packages
until: install_packages|success
retries: 5
delay: 2
with_items: "{{ rabbitmq_dependencies }}"
tags:
- rabbitmq-zypper-packages
- name: Install the RabbitMQ package
zypper:
name: "{{ (rabbitmq_install_method == 'file') | ternary(rabbitmq_package_path, rabbitmq_distro_packages) }}"
register: install_rabbitmq
tags:
- rabbitmq-package-rpm
- rabbitmq-zypper-packages
when: rabbitmq_install_method == 'file'
- name: Lock version of erlang packages
command: zypper addlock erlang*
register: zypper_addlock_erlang
changed_when: "zypper_addlock_erlang.stdout.find('successfully added') != -1"
- 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

View File

@ -6,19 +6,20 @@ rabbitmq_ssl_key: /etc/rabbitmq/rabbitmq.key
rabbitmq_hipe_compile: True
rabbitmq_old_package:
# NOTE(hwoarang): For openSUSE/Ubuntu, we install the old file explicitly. CentOS7 will get it from the external
# repo instead.
debian:
method: 'file'
rabbitmq_package_url: "http://www.rabbitmq.com/releases/rabbitmq-server/v3.6.9/rabbitmq-server_3.6.9-1_all.deb"
rabbitmq_package_sha256: "ff100febb8c409692e57f3dc98fd2fc667f83eeefa3958a6fda865ce40a40349"
rabbitmq_release_version: "3.6.9"
redhat:
method: 'external_repo'
rabbitmq_package_url: "http://www.rabbitmq.com/releases/rabbitmq-server/v3.6.9/rabbitmq-server-3.6.9-1.el7.noarch.rpm"
rabbitmq_package_sha256: "757fc6746a1700380b3ba9bf4f00dfa16cc5a0ddc8c94636c4388e838f605c31"
rabbitmq_release_version: "3.6.9"
# NOTE(hwoarang): On SUSE, we use 'rabbitmq_install_method = distro' since we
# always grab the package from the openSUSE repositories. As such, the
# following variables are never used but we keep them here just in case we
# change the installation method in the future.
suse:
method: 'file'
rabbitmq_package_url: "http://www.rabbitmq.com/releases/rabbitmq-server/v3.6.9/rabbitmq-server-3.6.9-1.suse.noarch.rpm"
rabbitmq_package_sha256: "c44813ab94463f83e3e74be04db7304120697a27df12ca057e3dbb32717af32f"
rabbitmq_release_version: "3.6.9"
@ -26,9 +27,15 @@ rabbitmq_old_package:
# NOTE(hwoarang): This normally matches the _rabbitmq_release_version variable
# in the vars/* distro files.
rabbitmq_new_package:
# NOTE(hwoarang): For openSUSE we get the new version from the repo.
# For Ubuntu keep the default which is 'file'. For CentOS will get it
# from the external repo
debian:
method: 'file'
rabbitmq_release_version: "3.6.11"
redhat:
method: 'external_repo'
rabbitmq_release_version: "3.6.11"
suse:
method: 'distro'
rabbitmq_release_version: "3.6.11"

View File

@ -19,6 +19,7 @@
# Install previous version of RabbitMQ server
- include: test-install-rabbitmq-server.yml
vars:
rabbitmq_install_method: "{{ rabbitmq_old_package[ansible_os_family | lower]['method'] }}"
rabbitmq_package_url: "{{ rabbitmq_old_package[ansible_os_family | lower]['rabbitmq_package_url'] }}"
rabbitmq_package_sha256: "{{ rabbitmq_old_package[ansible_os_family | lower]['rabbitmq_package_sha256'] }}"
@ -29,6 +30,7 @@
- include: test-install-rabbitmq-server.yml
vars:
rabbitmq_install_method: "{{ rabbitmq_new_package[ansible_os_family | lower]['method'] }}"
rabbitmq_upgrade: true
- include: test-rabbitmq-server-functional.yml

View File

@ -13,10 +13,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# Even though we install the rabbitmq-server from the openSUSE repositories
# (the Ocata OBS project) we still add these here in case we use them in the
# future.
_rabbitmq_install_method: file
_rabbitmq_install_method: distro
# These are all here as alternative ways to get the required packages either by
# installing the package directly or getting it from the CentOS mirror
_rabbitmq_package_url: "http://www.rabbitmq.com/releases/rabbitmq-server/v3.6.11/rabbitmq-server-3.6.11-1.suse.noarch.rpm"
_rabbitmq_package_version: "{{ rabbitmq_package_url.split('/')[-1].rsplit('.', 1)[0] }}"
_rabbitmq_release_version: "{{ rabbitmq_package_version.split('-')[2] }}"
@ -29,11 +29,6 @@ _rabbitmq_gpg_keys:
- key_name: 'erlang_solutions.asc'
keyserver: 'https://packages.erlang-solutions.com/ubuntu'
rabbitmq_dependencies:
- erlang
- openssl
- socat
rabbitmq_distro_packages:
- rabbitmq-server
- rabbitmq-server-plugins