Merge "add gentoo support to rabbitmq role"

This commit is contained in:
Zuul 2019-02-26 14:40:24 +00:00 committed by Gerrit Code Review
commit 282b5e1fe5
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: tags:
- rabbitmq-config - 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 - name: Create rabbitmq config
register: rabbit_config register: rabbit_config
template: template:

View File

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

View File

@ -46,6 +46,17 @@
- rabbitmq-zypper-packages - rabbitmq-zypper-packages
- skip_ansible_lint - 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 - name: Register a fact for the installed RabbitMQ version
set_fact: set_fact:
installed_rabbitmq: "{{ item }}" installed_rabbitmq: "{{ item }}"
@ -55,6 +66,7 @@
with_items: with_items:
- "{{ installed_rabbitmq_deb }}" - "{{ installed_rabbitmq_deb }}"
- "{{ installed_rabbitmq_rpm }}" - "{{ installed_rabbitmq_rpm }}"
- "{{ installed_rabbitmq_portage }}"
- name: Compare installed version of RabbitMQ with new version variable - name: Compare installed version of RabbitMQ with new version variable
fail: 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"