From 6b064b9a635b69b22094913583a6c45902dd0201 Mon Sep 17 00:00:00 2001 From: Joseph V Date: Thu, 2 Mar 2023 15:46:37 +0530 Subject: [PATCH] Update rabbitmq installation --- .../delfin-installer/scenarios/rabbitmq.yml | 71 ++----------------- installer/ansible/script/install_rabbitmq.sh | 56 +++++++++++++++ 2 files changed, 61 insertions(+), 66 deletions(-) create mode 100644 installer/ansible/script/install_rabbitmq.sh diff --git a/installer/ansible/roles/delfin-installer/scenarios/rabbitmq.yml b/installer/ansible/roles/delfin-installer/scenarios/rabbitmq.yml index 33ae699ca..8061ed70d 100644 --- a/installer/ansible/roles/delfin-installer/scenarios/rabbitmq.yml +++ b/installer/ansible/roles/delfin-installer/scenarios/rabbitmq.yml @@ -21,74 +21,13 @@ apt: autoclean: yes -- name: Import RabbitMQ public key - apt_key: - url: https://github.com/rabbitmq/signing-keys/releases/download/2.0/rabbitmq-release-signing-key.asc - state: present - become: yes - when: - - rabbitmqservice.stat.exists is undefined or rabbitmqservice.stat.exists == false - -- name: Add Launchpad Erlang PPA key - apt_key: - keyserver: keyserver.ubuntu.com - id: F77F1EDA57EBB1CC - become: yes - when: - - rabbitmqservice.stat.exists is undefined or rabbitmqservice.stat.exists == false - -- name: Add PackageCloud RabbitMQ repository - apt_key: - url: https://packagecloud.io/rabbitmq/rabbitmq-server/gpgkey - state: present - become: yes - when: - - rabbitmqservice.stat.exists is undefined or rabbitmqservice.stat.exists == false - -- name: Add RabbitMQ Erlang official repo - apt_repository: - repo: deb http://ppa.launchpad.net/rabbitmq/rabbitmq-erlang/ubuntu {{ ansible_distribution_release }} main - state: present - filename: rabbitmq - become: yes - when: - - rabbitmqservice.stat.exists is undefined or rabbitmqservice.stat.exists == false - -- name: Add RabbitMQ Server official repo - apt_repository: - repo: deb https://packagecloud.io/rabbitmq/rabbitmq-server/ubuntu/ {{ ansible_distribution_release }} main - state: present - filename: rabbitmq - become: yes - when: - - rabbitmqservice.stat.exists is undefined or rabbitmqservice.stat.exists == false - -- name: Import Erlang public key - apt_key: - url: https://packages.erlang-solutions.com/debian/erlang_solutions.asc - state: present - become: yes - when: - - rabbitmqservice.stat.exists is undefined or rabbitmqservice.stat.exists == false - -- name: Add Erlang official repo - apt_repository: - repo: deb https://binaries.erlang-solutions.com/debian {{ ansible_distribution_release }} contrib - state: present - filename: erlang - become: yes - when: - - rabbitmqservice.stat.exists is undefined or rabbitmqservice.stat.exists == false - -- name: Install RabbitMQ package - apt: - name: rabbitmq-server - update_cache: yes - install_recommends: yes - allow_unauthenticated: yes - state: present +- name: Install rabbitmq service + shell: "{{ item }}" + with_items: + - bash ./script/install_rabbitmq.sh "{{ ansible_distribution_release }}" become: yes when: + - ansible_distribution == 'Ubuntu' - rabbitmqservice.stat.exists is undefined or rabbitmqservice.stat.exists == false - name: Start the RabbitMQ server diff --git a/installer/ansible/script/install_rabbitmq.sh b/installer/ansible/script/install_rabbitmq.sh new file mode 100644 index 000000000..585b53cc0 --- /dev/null +++ b/installer/ansible/script/install_rabbitmq.sh @@ -0,0 +1,56 @@ +#!/usr/bin/env bash + +# Copyright 2023 The SODA Authors. +# +# 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. + +#sudo apt-get install curl gnupg apt-transport-https -y + +## Team RabbitMQ's main signing key +curl -1sLf "https://keys.openpgp.org/vks/v1/by-fingerprint/0A9AF2115F4687BD29803A206B73A36E6026DFCA" | sudo gpg --dearmor | sudo tee /usr/share/keyrings/com.rabbitmq.team.gpg > /dev/null +## Launchpad PPA that provides modern Erlang releases +curl -1sLf "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0xf77f1eda57ebb1cc" | sudo gpg --dearmor | sudo tee /usr/share/keyrings/net.launchpad.ppa.rabbitmq.erlang.gpg > /dev/null +## PackageCloud RabbitMQ repository +curl -1sLf "https://packagecloud.io/rabbitmq/rabbitmq-server/gpgkey" | sudo gpg --dearmor | sudo tee /usr/share/keyrings/io.packagecloud.rabbitmq.gpg > /dev/null + +release=$1 + +## Add apt repositories maintained by Team RabbitMQ +sudo tee /etc/apt/sources.list.d/rabbitmq.list <