| # |
| # |
| # Licensed to the Apache Software Foundation (ASF) under one |
| # or more contributor license agreements. See the NOTICE file |
| # distributed with this work for additional information |
| # regarding copyright ownership. The ASF licenses this file |
| # to you 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. |
| # |
| |
| --- |
| ################################################################################ |
| # Setup and run rabbitmq |
| - name: Install erlang latest version |
| yum: name=https://www.rabbitmq.com/releases/erlang/erlang-18.3-1.el7.centos.x86_64.rpm state=present |
| become: yes |
| |
| - name: Install Rabbitmq rpm |
| yum: name=https://www.rabbitmq.com/releases/rabbitmq-server/v3.6.3/rabbitmq-server-3.6.3-1.noarch.rpm state=present |
| become: yes |
| |
| - name: allow only selected networks to access Airavata RabbitMQ |
| firewalld: |
| zone: public |
| permanent: yes |
| state: enabled |
| rich_rule: rule family=ipv4 source address="{{ item }}" port port="{{ rabbitmq_port }}" protocol=tcp accept |
| immediate: yes |
| with_items: |
| - "{{ rabbitmq_subnets }}" |
| become: yes |
| |
| - name: allow only selected networks to access Airavata RabbitMQ Management Console |
| firewalld: |
| zone: public |
| permanent: yes |
| state: enabled |
| immediate: yes |
| rich_rule: rule family=ipv4 source address="{{ item }}" port port="{{ management_plugin_port }}" protocol=tcp accept |
| with_items: |
| - "{{ rabbitmq_subnets }}" |
| become: yes |
| |
| - name: Edit /etc/hosts file |
| lineinfile: dest=/etc/hosts line="{{ ansible_default_ipv4.address }} {{ ansible_fqdn.split('.')[0] }}" |
| notify: |
| - restart rabbitmq |
| become: yes |
| |
| - name: Start Rabbitmq server |
| service: name=rabbitmq-server state=started enabled=yes |
| become: yes |
| |
| - name: Enable rabbitmq management plugin |
| rabbitmq_plugin: names=rabbitmq_management state=enabled |
| notify: |
| - restart rabbitmq |
| become: yes |
| |
| - name: Create rabbitmq vhost {{ rabbitmq_vhost }} |
| rabbitmq_vhost: name="{{ rabbitmq_vhost }}" state=present |
| become: yes |
| |
| - name: Add user {{ rabbitmq_user }} to vhost {{ rabbitmq_vhost }} and give permission |
| rabbitmq_user: user="{{ rabbitmq_user }}" |
| password="{{ rabbitmq_password }}" |
| vhost="{{ rabbitmq_vhost }}" |
| tags="administrator" |
| configure_priv=.* |
| read_priv=.* |
| write_priv=.* |
| state=present |
| become: yes |
| |
| - name: restart rabbitmq |
| service: name=rabbitmq-server state=restarted |
| become: yes |
| |
| ... |