Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added redhat support #44

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
106 changes: 106 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/

.idea
9 changes: 9 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,12 @@ rabbitmq_shovels:
-
shovel_name:
shovel_json: ''


rabbit_rpm_package_url: https://github.com/rabbitmq/rabbitmq-server/releases/download/v3.7.4
rabbit_rpm_package_name: rabbitmq-server-3.7.4-1.el6.noarch.rpm

erlang_rpm_package_url: https://github.com/rabbitmq/erlang-rpm/releases/download/v19.3.6.8
erlang_rpm_package_name: erlang-19.3.6.8-1.el6.x86_64.rpm

rabbit_update_host: True
3 changes: 3 additions & 0 deletions meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ galaxy_info:
versions:
- squeeze
- wheezy
- name: Amazon Linux
versions:
- 2017.09
categories:
- clustering
dependencies: []
3 changes: 2 additions & 1 deletion tasks/cluster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@

- name: skip fail if the node is already a member of the cluster
fail: msg="join_cluster failed but node is not already a member"
when: ("'already_member' not in join_cluster_output.stderr") and
when: ('cannot cluster node with itself' not in join_cluster_output.stderr) and
('already_member' not in join_cluster_output.stderr) and
(join_cluster_output.rc != 0)

- name: start rabbitmq app
Expand Down
9 changes: 9 additions & 0 deletions tasks/config-cluster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
dest: /etc/hosts
line: "{{ hostvars[item]['ansible_default_ipv4']['address'] }} {{ hostvars[item]['ansible_hostname'] }}"
with_items: "{{ groups['rabbit'] }}"
when: rabbit_update_host == True

- name: backup old erlang cookie
shell: cp -a /var/lib/rabbitmq/.erlang.cookie /var/lib/rabbitmq/.erlang.cookie.old
Expand Down Expand Up @@ -36,3 +37,11 @@
path: /var/lib/rabbitmq/.erlang.cookie.old
state: absent
changed_when: false

- name: ensure pid directory is present and has the right permissions
file:
path: /var/run/rabbitmq/
owner: rabbitmq
group: rabbitmq
mode: 0700
state: directory
11 changes: 1 addition & 10 deletions tasks/packages.yml → tasks/logrotate.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
---
# Install required packages

- name: install required packages
apt:
update_cache: yes
force: yes
pkg: "{{ item }}"
state: present
with_items:
- rabbitmq-server
# Customize logrotate rules

- name: customize logrotate rules
template:
Expand Down
17 changes: 15 additions & 2 deletions tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,23 @@
---

- include: repository.yml
- include: repository-yum.yml
tags: repository
when: ansible_os_family == 'RedHat'

- include: packages.yml
- include: repository-apt.yml
tags: repository
when: ansible_os_family == 'Debian'

- include: packages-yum.yml
tags: packages
when: ansible_os_family == 'RedHat'

- include: packages-apt.yml
tags: packages
when: ansible_os_family == 'Debian'

- include: logrotate.yml
tags: [packages,rabbitmq]

- include: config-cluster.yml
when: rabbitmq_create_cluster
Expand Down
12 changes: 12 additions & 0 deletions tasks/packages-apt.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
# Install required packages

- name: install required packages
apt:
update_cache: yes
force: yes
pkg: "{{ item }}"
state: present
with_items:
- rabbitmq-server

34 changes: 34 additions & 0 deletions tasks/packages-yum.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
# Install required packages

- name: installing prerequisite
yum:
name: "{{ item }}"
state: present
become: true
with_items:
- epel-release
- wget

- name: downloading Erlang
get_url:
url: "{{ erlang_rpm_package_url }}/{{ erlang_rpm_package_name }}"
dest: "/opt/{{ erlang_rpm_package_name }}"

- name: install Erlang packages
yum:
update_cache: yes
name: "/opt/{{ erlang_rpm_package_name }}"
state: present


- name: downloading RabbitMQ
get_url:
url: "{{ rabbit_rpm_package_url }}/{{ rabbit_rpm_package_name }}"
dest: "/opt/{{ rabbit_rpm_package_name }}"

- name: install RabbitMQ package
yum:
update_cache: yes
name: "/opt/{{ rabbit_rpm_package_name }}"
state: present
1 change: 1 addition & 0 deletions tasks/repository.yml → tasks/repository-apt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@
update_cache: yes
state: present


6 changes: 6 additions & 0 deletions tasks/repository-yum.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
- name: Ensure RabbitMQ RPM key is present
rpm_key:
key: https://dl.bintray.com/rabbitmq/Keys/rabbitmq-release-signing-key.asc
state: present

2 changes: 1 addition & 1 deletion templates/etc/default/rabbitmq-server.j2
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
ulimit -n {{ rabbitmq_ulimit_open_files }}

ERL_EPMD_PORT={{ rabbitmq_epmd_port }}
RABBITMQ_NODE_PORT= {{ rabbitmq_node_port }}
RABBITMQ_NODE_PORT={{ rabbitmq_node_port }}