Skip to content

Commit

Permalink
Fixed linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
mrlesmithjr committed Dec 21, 2023
1 parent ded7bf2 commit 949b04e
Show file tree
Hide file tree
Showing 28 changed files with 151 additions and 117 deletions.
2 changes: 2 additions & 0 deletions .ansible-lint
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
skip_list:
- name[casing]
26 changes: 24 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
venv/
!*

### Ansible
.cache/

### VirtualEnv ###
# Virtualenv
.venv/
poetry.lock
venv/

### VisualStudioCode ###
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
*.code-workspace

# Local History for Visual Studio Code
.history/

### VisualStudioCode Patch ###
# Ignore all local history of files
.history
.ionide
2 changes: 1 addition & 1 deletion handlers/main.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
# handlers file for ansible-rabbitmq
- name: restart rabbitmq-server
service:
ansible.builtin.service:
name: rabbitmq-server
state: restarted
become: true
21 changes: 5 additions & 16 deletions meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,22 @@ galaxy_info:
author: Larry Smith Jr.
description: Ansible role to install/configure RabbitMQ
license: MIT
min_ansible_version: 1.2
min_ansible_version: "1.2"
role_name: rabbitmq
namespace: mrlesmithjr
platforms:
- name: EL
versions:
- 8
- all
- name: Fedora
versions:
# - 22
# - 23
- 24
- 25
- 26
- 27
- 28
- 29
- all
- name: Ubuntu
versions:
- focal
- bionic
# - trusty
# - xenial
- all
- name: Debian
versions:
- buster
- stretch
- all
galaxy_tags:
- clustering
- system
Expand Down
2 changes: 1 addition & 1 deletion molecule/centos7/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
hosts: all
tasks:
- name: Example assertion
assert:
ansible.builtin.assert:
that: true
2 changes: 1 addition & 1 deletion molecule/centos8/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
hosts: all
tasks:
- name: Example assertion
assert:
ansible.builtin.assert:
that: true
2 changes: 1 addition & 1 deletion molecule/debian10/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
hosts: all
tasks:
- name: Example assertion
assert:
ansible.builtin.assert:
that: true
2 changes: 1 addition & 1 deletion molecule/debian8/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
hosts: all
tasks:
- name: Example assertion
assert:
ansible.builtin.assert:
that: true
2 changes: 1 addition & 1 deletion molecule/debian9/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
hosts: all
tasks:
- name: Example assertion
assert:
ansible.builtin.assert:
that: true
2 changes: 1 addition & 1 deletion molecule/fedora/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
hosts: all
tasks:
- name: Example assertion
assert:
ansible.builtin.assert:
that: true
2 changes: 1 addition & 1 deletion molecule/shared/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
hosts: all
tasks:
- name: Include ansible-rabbitmq
include_role:
ansible.builtin.include_role:
name: ansible-rabbitmq
9 changes: 9 additions & 0 deletions molecule/shared/prepare.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
- name: Prepare hosts for testing
hosts: all
tasks:
- name: Update Apt Cache
ansible.builtin.apt:
update_cache: true
become: true
when: ansible_os_family == "Debian"
2 changes: 1 addition & 1 deletion molecule/shared/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
hosts: all
tasks:
- name: Example assertion
assert:
ansible.builtin.assert:
that: true
2 changes: 1 addition & 1 deletion molecule/ubuntu1604/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
hosts: all
tasks:
- name: Example assertion
assert:
ansible.builtin.assert:
that: true
2 changes: 1 addition & 1 deletion molecule/ubuntu1804/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
hosts: all
tasks:
- name: Example assertion
assert:
ansible.builtin.assert:
that: true
2 changes: 1 addition & 1 deletion molecule/ubuntu2004/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
rabbitmq_debian_repo: "deb https://dl.bintray.com/rabbitmq-erlang/debian {{ ansible_distribution_release }} erlang-22.x"
tasks:
- name: Include ansible-rabbitmq
include_role:
ansible.builtin.include_role:
name: ansible-rabbitmq
2 changes: 1 addition & 1 deletion molecule/ubuntu2004/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
hosts: all
tasks:
- name: Example assertion
assert:
ansible.builtin.assert:
that: true
2 changes: 1 addition & 1 deletion playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
hosts: all
tasks:
- name: Include ansible-rabbitmq
include_role:
ansible.builtin.include_role:
name: ansible-rabbitmq
4 changes: 2 additions & 2 deletions tasks/config.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
---
- name: config | Configuring RabbitMQ
template:
ansible.builtin.template:
src: "{{ rabbitmq_config_file }}"
dest: "/etc/rabbitmq/rabbitmq.config"
mode: u=rw,g=r,o=r
become: true
notify: "restart rabbitmq-server"

- name: config | Configuring RabbitMQ environemnt
template:
ansible.builtin.template:
src: "{{ rabbitmq_config_env_file }}"
dest: "/etc/rabbitmq/rabbitmq-env.conf"
mode: u=rw,g=r,o=r
Expand Down
18 changes: 9 additions & 9 deletions tasks/debian.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
- name: debian | Adding Pre-Reqs
apt:
ansible.builtin.apt:
name:
- gnupg2
- apt-transport-https
Expand All @@ -11,15 +11,15 @@
until: result is successful

- name: debian | adding RabbitMQ repo public GPG key to the apt repo
apt_key:
ansible.builtin.apt_key:
url: "{{ rabbitmq_debian_repo_key }}"
state: present
become: true
register: result
until: result is successful

- name: debian | adding RabbitMQ team public GPG key to the apt repo
apt_key:
ansible.builtin.apt_key:
keyserver: keys.openpgp.org
id: "{{ rabbitmq_debian_team_key }}"
state: present
Expand All @@ -28,39 +28,39 @@
until: result is successful

- name: debian | adding RabbitMQ repo
apt_repository:
ansible.builtin.apt_repository:
repo: "{{ rabbitmq_debian_repo }}"
state: present
become: true
register: result
until: result is successful

- name: debian | adding RabbitMQ relang repo public GPG key to the apt repo
apt_key:
ansible.builtin.apt_key:
url: "{{ rabbitmq_debian_erlang_repo_key }}"
state: present
become: true
register: result
until: result is successful

- name: debian | add Rabbitmq erlang repo
apt_repository:
ansible.builtin.apt_repository:
repo: "{{ rabbitmq_debian_erlang_repo }}"
state: present
become: true
when: rabbitmq_debian_erlang_from_rabbit

- name: debian | installing RabbitMQ server
apt:
ansible.builtin.apt:
name:
- rabbitmq-server{{ (rabbitmq_debian_version_defined and rabbitmq_debian_version is defined) | ternary(['=',rabbitmq_debian_version] | join(''),'') }}
- rabbitmq-server{{ (rabbitmq_debian_version_defined and rabbitmq_debian_version is defined) | ternary(['=', rabbitmq_debian_version] | join(''), '') }}
state: present
become: true
register: result
until: result is successful

- name: debian | ensuring that the RabbitMQ service is running
service:
ansible.builtin.service:
name: rabbitmq-server
state: started
enabled: yes
Expand Down
13 changes: 7 additions & 6 deletions tasks/fedora.yml
Original file line number Diff line number Diff line change
@@ -1,44 +1,45 @@
---
- name: fedora | installing pre-reqs
dnf:
ansible.builtin.dnf:
name: ['wget']
state: present
become: true
register: result
until: result is successful

- name: fedora | installing erlang
dnf:
ansible.builtin.dnf:
name: ['erlang']
state: present
become: true
register: result
until: result is successful

- name: fedora | adding RabbitMQ public GPG key
rpm_key:
ansible.builtin.rpm_key:
key: "{{ rabbitmq_redhat_repo_key }}"
state: present
become: true
register: result
until: result is successful

- name: fedora | downloading RabbitMQ
get_url:
ansible.builtin.get_url:
url: "{{ rabbitmq_redhat_url }}/{{ rabbitmq_redhat_package }}"
dest: "/opt/{{ rabbitmq_redhat_package }}"
mode: u=rw,g=r,o=r
become: true

- name: fedora | installing RabbitMQ
dnf:
ansible.builtin.dnf:
name: "/opt/{{ rabbitmq_redhat_package }}"
state: present
become: true
register: result
until: result is successful

- name: fedora | starting and enabling RabbitMQ service
service:
ansible.builtin.service:
name: rabbitmq-server
state: started
enabled: true
Expand Down
29 changes: 19 additions & 10 deletions tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,41 +1,50 @@
---
# tasks file for ansible-rabbitmq
- include: debian.yml
- name: Include Debian tasks
ansible.builtin.include_tasks: debian.yml
when: ansible_os_family == "Debian"

- include: redhat.yml
- name: Include RedHat tasks
ansible.builtin.include_tasks: redhat.yml
when: >
ansible_distribution == "CentOS" or
ansible_distribution == "Red Hat Enterprise Linux" or
ansible_distribution == "OracleLinux"
- include: fedora.yml
- name: Include Fedora tasks
ansible.builtin.include_tasks: fedora.yml
when: ansible_distribution == "Fedora"

- include: rabbitmq_plugins.yml
- name: Manage RabbitMQ plugins
ansible.builtin.include_tasks: rabbitmq_plugins.yml
when: rabbitmq_plugins is defined

- include: config.yml
- name: Configure RabbitMQ
ansible.builtin.include_tasks: config.yml
when: rabbitmq_config_service

- name: checking to see if already clustered
stat:
ansible.builtin.stat:
path: /etc/rabbitmq/clustered
become: true
register: clustered

- include: rabbitmq_clustering.yml
- name: Manage RabbitMQ clustering
ansible.builtin.include_tasks: rabbitmq_clustering.yml
when: >
rabbitmq_enable_clustering and
not clustered['stat']['exists']
- include: rabbitmq_vhosts.yml
- name: Manage RabbitMQ virtual hosts
ansible.builtin.include_tasks: rabbitmq_vhosts.yml
when: rabbitmq_extra_vhosts is defined

- include: rabbitmq_config.yml
- name: Configure RabbitMQ
ansible.builtin.include_tasks: rabbitmq_config.yml
when: >
rabbitmq_enable_clustering and
rabbitmq_config is defined
- include: rabbitmq_users.yml
- name: Manage RabbitMQ users
ansible.builtin.include_tasks: rabbitmq_users.yml
when: rabbitmq_users is defined
Loading

0 comments on commit 949b04e

Please sign in to comment.