-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 6dbc132
Showing
16 changed files
with
296 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
# .ansible-lint | ||
|
||
exclude_paths: | ||
- .github | ||
- .pre-commit-config.yaml | ||
|
||
skip_list: | ||
- '106' # Role name {} does not match ``^[a-z][a-z0-9_]+$`` pattern' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# EditorConfig helps developers define and maintain consistent | ||
# coding styles between different editors and IDEs | ||
# editorconfig.org | ||
|
||
root = true | ||
|
||
[*] | ||
# Change these settings to your own preference | ||
indent_size = 2 | ||
indent_style = space | ||
|
||
# We recommend you to keep these unchanged | ||
charset = utf-8 | ||
end_of_line = lf | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
--- | ||
name: Release to Galaxy | ||
|
||
on: | ||
push: | ||
tags: | ||
- '*' | ||
|
||
jobs: | ||
release: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
|
||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up Python 3 | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.x" | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -q ansible | ||
- name: Import role into Ansible Galaxy | ||
run: ansible-galaxy role import --api-key ${GALAXY_API_KEY} $(echo ${{ github.repository }} | cut -d/ -f1) $(echo ${{ github.repository }} | cut -d/ -f2) | ||
env: | ||
GALAXY_API_KEY: ${{ secrets.GALAXY_API_KEY }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
--- | ||
name: Test ansible role | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- master | ||
schedule: | ||
- cron: "22 2 * * 2" | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up Python 3 | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.x" | ||
|
||
- name: Remove pre-installed ansible | ||
run: sudo apt-get remove --purge -y ansible | ||
|
||
- name: Install dependencies | ||
run: pip install ansible ansible-lint docker molecule molecule-plugins[docker] pytest-testinfra | ||
|
||
- name: Display versions | ||
run: | | ||
python -c "import sys; print(sys.version)" | ||
pip --version | ||
ansible --version | ||
molecule --version | ||
- name: Install role dependencies | ||
run: ansible-galaxy role install -r meta/requirements.yml | ||
|
||
- name: Lint code | ||
run: | | ||
ansible-lint | ||
black --check . | ||
env: | ||
PY_COLORS: "1" | ||
|
||
- name: Run Molecule | ||
run: molecule test | ||
env: | ||
PY_COLORS: "1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
__pycache__ | ||
*.pyc | ||
.cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# See https://pre-commit.com for more information | ||
# See https://pre-commit.com/hooks.html for more hooks | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.4.0 | ||
hooks: | ||
- id: trailing-whitespace | ||
- id: end-of-file-fixer | ||
- id: check-yaml | ||
- id: check-added-large-files | ||
- repo: https://github.com/psf/black | ||
rev: 23.3.0 | ||
hooks: | ||
- id: black |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2024 Nicolas Boutet | ||
|
||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
[![tests](https://github.com/boutetnico/ansible-role-percona-toolkit/workflows/Test%20ansible%20role/badge.svg)](https://github.com/boutetnico/ansible-role-percona-toolkit/actions?query=workflow%3A%22Test+ansible+role%22) | ||
[![Ansible Galaxy](https://img.shields.io/badge/galaxy-boutetnico.percona_toolkit-blue.svg)](https://galaxy.ansible.com/boutetnico/percona_toolkit) | ||
|
||
ansible-role-percona-toolkit | ||
============================ | ||
|
||
This role installs [percona-toolkit](https://docs.percona.com/percona-toolkit/). | ||
|
||
Requirements | ||
------------ | ||
|
||
Ansible 2.10 or newer. | ||
|
||
Supported Platforms | ||
------------------- | ||
|
||
- [Debian - 11 (Bullseye)](https://wiki.debian.org/DebianBullseye) | ||
- [Debian - 12 (Bookworm)](https://wiki.debian.org/DebianBookworm) | ||
- [Ubuntu - 22.04 (Jammy Jellyfish)](http://releases.ubuntu.com/22.04/) | ||
- [Ubuntu - 24.04 (Noble Numbat)](http://releases.ubuntu.com/24.04/) | ||
|
||
Role Variables | ||
-------------- | ||
|
||
| Variable | Required | Default | Choices | Comments | | ||
|---------------------------------|----------|---------------|-----------|---------------------------------------------------| | ||
| percona_toolkit_packages | true | | list | See `defaults/main.yml`. | | ||
| percona_toolkit_package_version | true | `present` | string | Use `latest` to update. | | ||
|
||
Dependencies | ||
------------ | ||
|
||
- [percona-release role](https://github.com/boutetnico/ansible-role-percona-release/) | ||
|
||
Example Playbook | ||
---------------- | ||
|
||
- hosts: all | ||
roles: | ||
- role: ansible-role-percona-toolkit | ||
|
||
|
||
Testing | ||
------- | ||
|
||
molecule test | ||
|
||
License | ||
------- | ||
|
||
MIT | ||
|
||
Author Information | ||
------------------ | ||
|
||
[@boutetnico](https://github.com/boutetnico) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--- | ||
percona_toolkit_packages: | ||
- percona-toolkit | ||
percona_toolkit_package_version: present |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
--- | ||
galaxy_info: | ||
role_name: percona_toolkit | ||
namespace: boutetnico | ||
author: Nicolas Boutet | ||
description: Install and configure percona-toolkit. | ||
license: MIT | ||
min_ansible_version: "2.10" | ||
platforms: | ||
- name: Ubuntu | ||
versions: | ||
- jammy | ||
- noble | ||
- name: Debian | ||
versions: | ||
- bookworm | ||
- bullseye | ||
galaxy_tags: | ||
- percona | ||
- toolkit | ||
dependencies: | ||
- role: boutetnico.percona_release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
- src: https://github.com/boutetnico/ansible-role-percona-release.git | ||
name: boutetnico.percona_release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Molecule managed | ||
|
||
{% if item.registry is defined %} | ||
FROM {{ item.registry.url }}/{{ item.image }} | ||
{% else %} | ||
FROM {{ item.image }} | ||
{% endif %} | ||
|
||
{% if item.env is defined %} | ||
{% for var, value in item.env.items() %} | ||
{% if value %} | ||
ENV {{ var }} {{ value }} | ||
{% endif %} | ||
{% endfor %} | ||
{% endif %} | ||
|
||
ENV DEBIAN_FRONTEND=noninteractive | ||
|
||
RUN apt-get update && apt-get install -y python3 sudo bash ca-certificates iproute2 python3-apt aptitude && apt-get clean && rm -rf /var/lib/apt/lists/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
- name: Converge | ||
hosts: all | ||
|
||
roles: | ||
- role: boutetnico.percona_toolkit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
--- | ||
dependency: | ||
name: galaxy | ||
enabled: false | ||
|
||
driver: | ||
name: docker | ||
|
||
platforms: | ||
- name: ansible-role-percona-toolkit-debian-11 | ||
image: debian:11 | ||
- name: ansible-role-percona-toolkit-debian-12 | ||
image: debian:12 | ||
- name: ansible-role-percona-toolkit-ubuntu-2204 | ||
image: ubuntu:22.04 | ||
- name: ansible-role-percona-toolkit-ubuntu-2404 | ||
image: ubuntu:24.04 | ||
|
||
provisioner: | ||
name: ansible | ||
|
||
verifier: | ||
name: testinfra |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import pytest | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"name", | ||
[ | ||
("percona-toolkit"), | ||
], | ||
) | ||
def test_packages_are_installed(host, name): | ||
package = host.package(name) | ||
assert package.is_installed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
- name: Ensure percona toolkit is installed | ||
ansible.builtin.apt: | ||
name: "{{ percona_toolkit_packages }}" | ||
state: "{{ percona_toolkit_package_version }}" | ||
environment: | ||
PERCONA_TELEMETRY_DISABLE: "1" |