add gentoo support to rabbitmq role

Depends-On: https://review.openstack.org/633272
Change-Id: If5e248566911f7545d6f230fb67d98af08e336f8
This commit is contained in:
Matthew Thode 2019-01-25 01:26:10 -06:00
parent 54a54babf2
commit 13e493c77a
No known key found for this signature in database
GPG Key ID: 64A37BEAAE19A4E8
6 changed files with 94 additions and 2 deletions

32
tasks/install_portage.yml Normal file
View File

@ -0,0 +1,32 @@
---
# Copyright 2019, Matthew Thode
#
# 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 not 'distro'
fail:
msg: "The only supported rabbitmq_install_method for openSUSE is 'distro'."
when: rabbitmq_install_method != 'distro'
- name: Install the RabbitMQ package
portage:
name: "{{ rabbitmq_distro_packages }}"
state: "{{ rabbitmq_package_state }}"
newuse: "{{ (ansible_pkg_mgr == 'portage') | ternary('yes', omit) }}"
changed_use: "{{ (ansible_pkg_mgr == 'portage') | ternary('yes', omit) }}"
noreplace: "{{ (ansible_pkg_mgr == 'portage') | ternary('yes', omit) }}"
jobs: "{{ (ansible_pkg_mgr == 'portage') | ternary('4', omit) }}"
register: install_rabbitmq
tags:
- rabbitmq-package-portage
- rabbitmq-portage-packages

View File

@ -23,6 +23,16 @@
tags:
- rabbitmq-config
- name: Create rabbitmq config directory
file:
path: "/etc/rabbitmq"
state: directory
group: "rabbitmq"
owner: "rabbitmq"
mode: 0755
tags:
- rabbitmq-config
- name: Create rabbitmq config
register: rabbit_config
template:

View File

@ -15,7 +15,7 @@
- name: "Ensure RabbitMQ node [0] is started"
service:
name: rabbitmq-server
name: "{{ rabbitmq_service_name }}"
state: started
enabled: yes
when:
@ -27,7 +27,7 @@
- name: "Ensure RabbitMQ nodes [1:] are started"
service:
name: rabbitmq-server
name: "{{ rabbitmq_service_name }}"
state: started
enabled: yes
when:

View File

@ -46,6 +46,17 @@
- rabbitmq-zypper-packages
- skip_ansible_lint
- name: Get version of installed RabbitMQ package (portage)
shell: "equery l net-misc/rabbitmq-server --format '$version' | tail -n 1"
failed_when: false
register: installed_rabbitmq_portage
when:
- not rabbitmq_upgrade | bool
- ansible_pkg_mgr == 'portage'
tags:
- rabbitmq-package-portage
- rabbitmq-portage-packages
- name: Register a fact for the installed RabbitMQ version
set_fact:
installed_rabbitmq: "{{ item }}"
@ -55,6 +66,7 @@
with_items:
- "{{ installed_rabbitmq_deb }}"
- "{{ installed_rabbitmq_rpm }}"
- "{{ installed_rabbitmq_portage }}"
- name: Compare installed version of RabbitMQ with new version variable
fail:

22
vars/gentoo.yml Normal file
View File

@ -0,0 +1,22 @@
---
# Copyright 2019, Matthew Thode
#
# 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.
_rabbitmq_install_method: distro
_rabbitmq_package_version: ''
rabbitmq_service_name: "rabbitmq"
rabbitmq_distro_packages:
- net-misc/rabbitmq-server

16
vars/main.yml Normal file
View File

@ -0,0 +1,16 @@
---
# Copyright 2016, 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.
rabbitmq_service_name: "rabbitmq-server"