Skip to content

Commit

Permalink
Merge pull request #6 from bmeme/5_update_default_mule_version_refact…
Browse files Browse the repository at this point in the history
…or_molecule_test

feat(update): Updated Mule version - Refactored Molecule test in GitH…
  • Loading branch information
g0blin79 authored Dec 23, 2023
2 parents 20e45a1 + d1d66bd commit 9fda9d7
Show file tree
Hide file tree
Showing 12 changed files with 107 additions and 153 deletions.
13 changes: 11 additions & 2 deletions .ansible-lint
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
---
skip_list:
- 'yaml'
- 'role-name'
- "305"
- "503"
warn_list:
- risky-shell-pipe
- experimental
- key-order[task]
- name[casing]
- var-naming[pattern]
exclude_paths:
- molecule/
66 changes: 22 additions & 44 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,65 +1,43 @@
---
name: Ansible Role Mule CI
name: Ansible Role Mule
'on':
pull_request:
push:
branches:
- main

defaults:
run:
working-directory: 'bmeme.mule'

jobs:

lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Check out the codebase.
uses: actions/checkout@v2
with:
path: 'bmeme.mule'

- name: Set up Python 3.
uses: actions/setup-python@v2
with:
python-version: '3.x'

- name: Install test dependencies.
run: pip3 install yamllint

- name: Lint code.
run: |
yamllint .
molecule:
name: Molecule
-
name: Check out the codebase.
uses: actions/checkout@v3
-
name: Run ansible-lint
uses: ansible/ansible-lint@main

test:
name: Testing ansible role bmeme.mule
runs-on: ubuntu-latest
needs: lint
strategy:
matrix:
distro:
- centos:7.9
- ol:8.6
- "rockylinux:8.7-2.11"
- "rockylinux:8.8-2.11"
- "rockylinux:8.9-2.11"
- "rockylinux:9.3-2.15"

steps:
- name: Check out the codebase.
uses: actions/checkout@v2
with:
path: 'bmeme.mule'

- name: Set up Python 3.
uses: actions/setup-python@v2
uses: actions/checkout@v3
-
name: Molecule test
uses: gofrolist/molecule-action@v2
with:
python-version: '3.x'

- name: Install test dependencies.
run: pip3 install ansible molecule[docker] docker

- name: Run Molecule tests.
run: molecule test
molecule_options: --debug
molecule_args: -d docker
molecule_command: test
env:
PY_COLORS: '1'
ANSIBLE_FORCE_COLOR: '1'
MOLECULE_DISTRO: ${{ matrix.distro }}
MOLECULE_PLAYBOOK: ${{ matrix.playbook }}
41 changes: 11 additions & 30 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,37 +1,18 @@
---
# This workflow requires a GALAXY_API_KEY secret present in the GitHub
# repository or organization.
#
# See: https://github.com/marketplace/actions/publish-ansible-role-to-galaxy

name: Ansible Role Mule Release
name: Ansible Role Mule
'on':
push:
tags:
- '*'

defaults:
run:
working-directory: 'bmeme.mule'
release:
types: ['created']

jobs:

release:
name: Release
name: Galaxy Role Importer
runs-on: ubuntu-latest
steps:
- name: Check out the codebase.
uses: actions/checkout@v2
-
name: Check out the codebase
uses: actions/checkout@v4
-
name: Release on galaxy
uses: ansible-actions/[email protected]
with:
path: 'bmeme.mule'

- name: Set up Python 3.
uses: actions/setup-python@v2
with:
python-version: '3.x'

- name: Install Ansible.
run: pip3 install ansible-base

- name: Trigger a new import on Galaxy.
run: ansible-galaxy role import --api-key ${{ secrets.GALAXY_API_KEY }} $(echo ${{ github.repository }} | cut -d/ -f1) $(echo ${{ github.repository }} | cut -d/ -f2)
galaxy_api_key: ${{ secrets.GALAXY_API_KEY }}
27 changes: 14 additions & 13 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
The MIT License (MIT)
MIT License

Copyright (c) 2017 Jeff Geerling
Copyright (c) 2021 Bonsaimeme S.r.l.

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
54 changes: 17 additions & 37 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,51 +1,42 @@
![example workflow](https://github.com/bmeme/ansible-role-mule/actions/workflows/ci.yml/badge.svg?branch=main)

[![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg)](https://GitHub.com/Naereen/StrapDown.js/graphs/commit-activity)
[![MIT license](https://img.shields.io/badge/License-MIT-blue.svg)](https://lbesson.mit-license.org/)

Ansible Role: Mule
=========

Installs [Mule](https://www.mulesoft.com/) on Linux servers.

Requirements
------------
Installs [Mule Community Edition](https://www.mulesoft.com/) on Linux servers.

## Requirements
Java must be available on the server.
You can easily install Java using the great [Geerlingguy role](https://github.com/geerlingguy/ansible-role-java) `geerlingguy.java` role.
But you can use others obviously.
However, you can also use other roles, of course.

Make sure the Java version installed meets the Mule requirements.

Installation
------------
Ensure that the installed Java version meets Mule's requirements.

## Installation
This is an Ansible role distributed using Ansible Galaxy. In order to install this role you can use the following command.

`$ ansible-galaxy install bmeme.mule`

Update
------

## Update
If you want to update the role, you need to pass --force parameter when installing. Please, check the following command:

`$ ansible-galaxy install --force bmeme.mule`

Role Variables
--------------
## Role Variables
Basic variables are:

| Variable Name | Description | Default |
|----------------|--------------|----------|
| `mule_version` | The version of Mule you want to install. Get a look [here](https://repository-master.mulesoft.org/nexus/content/repositories/releases/org/mule/distributions/mule-standalone/)| `4.2.1`|
| `mule_version` | The version of Mule you want to install. Get a look [here](https://repository-master.mulesoft.org/nexus/content/repositories/releases/org/mule/distributions/mule-standalone/)| `4.5.0`|
| `mule_group` | The system group to create running Mule | `mule` |
| `mule_user` | The system user to create running Mule | `mule` |
| `mule_home` | Directory that hosts Mule | `/opt/mule` |
| `mule_remove_package` | Remove "tar.gz" Mule package when been installed | `true` |
| `mule_restart_handler_enabled` | Restart/Start Mule after installation | `true` |

Mule Configuration Properties
-----------------------------

## Mule Configuration Properties
This role injects these configuration files into mule installation folder *before* to start it:
- http-server-socket.conf
- scheduler-pools.conf
Expand Down Expand Up @@ -131,12 +122,10 @@ wrapper_extended_configuration: ""
```
To best configure your Mule instance take a look at the official documentation [here](https://docs.mulesoft.com/general/)

Dependencies
------------
## Dependencies
N/A

Example Playbook
----------------
## Example Playbook

Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:

Expand All @@ -147,23 +136,14 @@ Including an example of how to use your role (for instance, with variables passe
- geerlingguy.java # for example
- bmeme.mule

License
-------

MIT/BSD
## License
MIT

Author Information
------------------
This role was created by [Bmeme](https://www.bmeme.com).
## Author Information
This role was created by [Bmeme](https://www.bmeme.com). It is actually maintained by [Daniele Piaggesi](https://github.com/g0blin79) and [Roberto Mariani](https://github.com/jean-louis).

Credits
-------
## Credits
Building this role we are influenced by other roles we usually use/used and their approaches.
Thanks to the great works of:
- [geerligguy](https://github.com/geerlingguy)
- [lean-delivery](https://github.com/lean-delivery)

Author Information
------------------

An optional section for the role authors to include contact information, or a website (HTML is not allowed).
3 changes: 2 additions & 1 deletion meta/main.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
---
galaxy_info:
role_name: mule
namespace: bmeme
author: Daniele Piaggesi <[email protected]>
description: This role provides installation of Mulesoft
company: Bonsaimeme S.r.l.
license: "license (BSD, MIT)"
min_ansible_version: 2.1
min_ansible_version: "2.11"
platforms:
- name: EL
versions:
Expand Down
1 change: 1 addition & 0 deletions molecule/default/converge-vars.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
java_packages:
- java-11-openjdk

Expand Down
13 changes: 6 additions & 7 deletions molecule/default/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
scenario:
test_sequence:
- dependency
- lint
- cleanup
- destroy
- syntax
Expand All @@ -18,20 +17,20 @@ dependency:
name: galaxy
driver:
name: docker
lint: |
set -e
yamllint .
platforms:
- name: instance
image: "bmeme/docker-ansible-${MOLECULE_DISTRO:-centos:7}"
image: "bmeme/docker-ansible-${MOLECULE_DISTRO:-rockylinux:8.7-2.11}"
command: "/usr/sbin/init"
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
- /sys/fs/cgroup:/sys/fs/cgroup:rw
privileged: true
cgroupns_mode: host
pre_build_image: true
provisioner:
name: ansible
log: true
lint:
name: ansible-lint
enabled: true
verifier:
name: ansible
enabled: false
Loading

0 comments on commit 9fda9d7

Please sign in to comment.