Compare commits
No commits in common. "master" and "3.3.0" have entirely different histories.
2
LICENSE
2
LICENSE
|
|
@ -186,7 +186,7 @@
|
|||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright 2024 Robert de Bock (robert@meinit.nl)
|
||||
Copyright 2023 Robert de Bock (robert@meinit.nl)
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
|
|
|
|||
|
|
@ -24,9 +24,9 @@ The intention is to focus on writing or maintaining the Ansible role, and use th
|
|||
| templates/* | | | molecule/default/molecule.yml |
|
||||
+-------------------+ | +--- this tool ---+ | .github/workflows/requirements2png.yml |
|
||||
+--> | generate.yml | --> | SECURITY.md |
|
||||
+-----------------+ | settings.yml |
|
||||
| .github/workflows/todo.yml |
|
||||
| .tox.ini |
|
||||
+--- Galaxy ---+ | +-----------------+ | settings.yml |
|
||||
| galaxy_id | --------+ | .github/workflows/todo.yml |
|
||||
+--------------+ | .tox.ini |
|
||||
+----------------------------------------+
|
||||
```
|
||||
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@ generate_github_action_molecule: yes
|
|||
generate_github_action_galaxy: yes
|
||||
generate_github_action_todo: yes
|
||||
generate_gitlab_ci: yes
|
||||
generate_requirements_txt: yes
|
||||
generate_requirements2png: yes
|
||||
generate_github_funding: yes
|
||||
generate_github_issue_template: yes
|
||||
|
|
|
|||
|
|
@ -1,11 +0,0 @@
|
|||
---
|
||||
name: Pull request
|
||||
about: Describe the proposed change
|
||||
|
||||
---
|
||||
|
||||
**Describe the change**
|
||||
A clear and concise description of what the pull request is.
|
||||
|
||||
**Testing**
|
||||
In case a feature was added, how were tests performed?
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
molecule
|
||||
molecule-plugins[docker]
|
||||
paramiko
|
||||
|
|
@ -9,8 +9,7 @@ rules:
|
|||
max-spaces-inside: 1
|
||||
level: error
|
||||
line-length: disable
|
||||
truthy:
|
||||
check-keys: false
|
||||
truthy: disable
|
||||
|
||||
ignore: |
|
||||
.tox/
|
||||
|
|
|
|||
26
generate.yml
26
generate.yml
|
|
@ -89,6 +89,13 @@
|
|||
when:
|
||||
- verify.stat.exists
|
||||
|
||||
- name: Load galaxy_id
|
||||
ansible.builtin.shell:
|
||||
cmd: "set -o pipefail ; ansible-galaxy info {{ galaxy_namespace }}.{{ role_name }} | grep ' id: ' | awk '{print $NF}'" # noqa no-tabs
|
||||
register: galaxy_id
|
||||
changed_when: no
|
||||
failed_when: no
|
||||
|
||||
- name: Create .github directories
|
||||
ansible.builtin.file:
|
||||
path: "{{ role_path }}/{{ item }}"
|
||||
|
|
@ -119,10 +126,6 @@
|
|||
dest: .yamllint
|
||||
- source: pre-commit-config.yaml
|
||||
dest: .pre-commit-config.yaml
|
||||
- source: pull_request_template.md
|
||||
dest: .github/pull_request_template.md
|
||||
- source: requirements.txt
|
||||
dest: requirements.txt
|
||||
loop_control:
|
||||
label: "{{ item.source }}"
|
||||
|
||||
|
|
@ -150,11 +153,6 @@
|
|||
when:
|
||||
- generate_tox
|
||||
|
||||
# - name: Remove tox.ini
|
||||
# ansible.builtin.file:
|
||||
# path: "{{ role_path }}/tox.ini"
|
||||
# state: absent
|
||||
|
||||
- name: Render file .github/settings.yml
|
||||
ansible.builtin.template:
|
||||
src: "{{ playbook_dir }}/templates/settings.yml.j2"
|
||||
|
|
@ -198,7 +196,7 @@
|
|||
- name: Render file .github/workflows/molecule.yml
|
||||
ansible.builtin.template:
|
||||
src: "{{ playbook_dir }}/templates/molecule-action.yml.j2"
|
||||
dest: "{{ role_path }}/.github/workflows/molecule.yml"
|
||||
dest: "{{ role_path }}/.github/workflows/molecule.ymlmd"
|
||||
mode: "0644"
|
||||
when:
|
||||
- generate_github_action_molecule
|
||||
|
|
@ -227,6 +225,14 @@
|
|||
when:
|
||||
- generate_gitlab_ci
|
||||
|
||||
- name: Render file requirements.txt
|
||||
ansible.builtin.template:
|
||||
src: "{{ playbook_dir }}/templates/requirements.txt.j2"
|
||||
dest: "{{ role_path }}/requirements.txt"
|
||||
mode: "0644"
|
||||
when:
|
||||
- generate_requirements_txt
|
||||
|
||||
- name: Render file .github/workflows/requirements2png.yml
|
||||
ansible.builtin.template:
|
||||
src: "{{ playbook_dir }}/templates/requirements2png.yml.j2"
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
|GitHub|GitLab|Downloads|Version|
|
||||
|------|------|---------|-------|
|
||||
|[](https://github.com/{{ github_namespace }}/ansible-role-{{ role_name }}/actions)|[](https://gitlab.com/{{ gitlab_namespace }}/ansible-role-{{ role_name }})|[](https://galaxy.ansible.com/{{ galaxy_namespace }}/{{ role_name }})|[](https://github.com/{{ github_namespace }}/ansible-role-{{ role_name }}/releases/)|
|
||||
|[](https://github.com/{{ github_namespace }}/ansible-role-{{ role_name }}/actions)|[](https://gitlab.com/{{ gitlab_namespace }}/ansible-role-{{ role_name }})|[ }})](https://galaxy.ansible.com/{{ github_namespace }}/{{ role_name }})|[](https://github.com/{{ github_namespace }}/ansible-role-{{ role_name }}/releases/)|
|
||||
|
||||
## [Example Playbook](#example-playbook)
|
||||
|
||||
|
|
|
|||
|
|
@ -17,5 +17,8 @@ exclude_paths:
|
|||
- .github
|
||||
- requirements.yml
|
||||
|
||||
skip_list:
|
||||
- yaml[truthy]
|
||||
|
||||
enable_list:
|
||||
- name[prefix]
|
||||
|
|
|
|||
|
|
@ -1,16 +1,13 @@
|
|||
---
|
||||
image: "{{ gitlab_container }}"
|
||||
|
||||
variables:
|
||||
DEBIAN_FRONTEND: noninteractive
|
||||
PY_COLORS: 1
|
||||
|
||||
molecule:
|
||||
image: $python
|
||||
script:
|
||||
- apt-get update -qq
|
||||
- apt-get -y -qq install yamllint docker.io
|
||||
- pip install --no-cache-dir tox
|
||||
- if [ -f tox.ini ] ; then tox ; fi
|
||||
- if [ ! -f tox.ini ] ; then pip install -r requirements.yml ; pip install ansible-lint ansible-core ; molecule test ; fi
|
||||
- if [ ! -f tox.ini ] ; then molecule test ; fi
|
||||
rules:
|
||||
- if: $CI_COMMIT_REF_NAME == "master"
|
||||
parallel:
|
||||
|
|
@ -20,7 +17,6 @@ molecule:
|
|||
{% for tag in distribution_version_mapping[platform.name][version] %}
|
||||
- image: "{{ platform_image_mapping[platform.name] }}"
|
||||
tag: "{{ tag }}"
|
||||
python: {{ matrix_overrides[platform_image_mapping[platform.name] | lower ]["python"] | default(default_python_version) }}
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
|
|
|
|||
|
|
@ -16,61 +16,45 @@ jobs:
|
|||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v3
|
||||
- name: ansible-lint
|
||||
uses: ansible-community/ansible-lint-action@main
|
||||
{% for python_version in default_python_version %}
|
||||
|
||||
{{ python_version | replace('.', '-') | replace(':', '-') }}:
|
||||
test:
|
||||
needs:
|
||||
- lint
|
||||
runs-on: ubuntu-20.04
|
||||
container:
|
||||
image: {{ python_version }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
config:
|
||||
{% for platform in meta.galaxy_info.platforms %}
|
||||
{% for version in platform.versions %}
|
||||
{% if matrix_overrides is defined %}
|
||||
{% if matrix_overrides[platform_image_mapping[platform.name]] is defined %}
|
||||
{% for override_python_version in matrix_overrides[platform_image_mapping[platform.name]]["python"] %}
|
||||
{% if override_python_version == python_version %}
|
||||
{% for tag in distribution_version_mapping[platform.name][version] %}
|
||||
- image: "{{ platform_image_mapping[platform.name] }}"
|
||||
tag: "{{ tag }}"
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
{% for tag in distribution_version_mapping[platform.name][version] %}
|
||||
- image: "{{ platform_image_mapping[platform.name] }}"
|
||||
tag: "{{ tag }}"
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
path: {% raw %}"${{ github.repository }}"{% endraw %}
|
||||
|
||||
# - name: disable apparmor for mysql
|
||||
# run: sudo ln -s /etc/apparmor.d/usr.sbin.mysqld /etc/apparmor.d/disable/
|
||||
# - name: parse apparmor for mysql
|
||||
# run: sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld
|
||||
- name: molecule
|
||||
run: |
|
||||
apt-get update -qq
|
||||
apt-get -y -qq install yamllint docker.io
|
||||
pip install --no-cache-dir tox
|
||||
if [ -f tox.ini ] ; then tox ; fi
|
||||
if [ ! -f tox.ini ] ; then pip install -r requirements.yml ; pip install ansible-lint ansible-core ; molecule test ; fi
|
||||
env:
|
||||
uses: {{ molecule_action }}
|
||||
with:
|
||||
image: {% raw %}${{ matrix.config.image }}{% endraw %}
|
||||
|
||||
tag: {% raw %}${{ matrix.config.tag }}{% endraw %}
|
||||
{% if github_variables_mapping is defined %}
|
||||
|
||||
{% if github_variables_mapping is defined %}
|
||||
env:
|
||||
{% for item in github_variables_mapping %}
|
||||
{{ item.variable }}: {% raw %}${{ {%endraw %}{{ item.name }} {% raw %}}}{% endraw %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
|
|
|||
|
|
@ -16,9 +16,9 @@ platforms:
|
|||
image: "${namespace:-{{ docker_namespace }}}/${image:-{{ docker_image }}}:${tag:-{{ docker_tag }}}"
|
||||
command: /sbin/init
|
||||
volumes:
|
||||
- /sys/fs/cgroup:/sys/fs/cgroup:rw
|
||||
privileged: true
|
||||
pre_build_image: true
|
||||
- /sys/fs/cgroup:/sys/fs/cgroup:ro
|
||||
privileged: yes
|
||||
pre_build_image: yes
|
||||
provisioner:
|
||||
name: ansible
|
||||
{% if github_variables_mapping is defined %}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,5 @@
|
|||
ansible-compat == 4.*
|
||||
molecule == 6.*
|
||||
molecule-plugins[docker] == 23.*
|
||||
ansible-lint == 6.*
|
||||
paramiko == 3.*
|
||||
|
|
@ -13,7 +13,7 @@ jobs:
|
|||
contents: write
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
path: {% raw %}${{ github.repository }}{% endraw %}
|
||||
|
||||
|
|
|
|||
|
|
@ -10,9 +10,9 @@ jobs:
|
|||
build:
|
||||
runs-on: "ubuntu-20.04"
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: "actions/checkout@master"
|
||||
- name: "TODO to Issue"
|
||||
uses: "alstr/todo-to-issue-action@v4"
|
||||
uses: "alstr/todo-to-issue-action@v2.3"
|
||||
id: "todo"
|
||||
with:
|
||||
TOKEN: ${% raw %}{{ secrets.GITHUB_TOKEN }}{% endraw %}
|
||||
|
|
|
|||
|
|
@ -1,48 +1,37 @@
|
|||
{{ ansible_managed | comment }}
|
||||
[tox]
|
||||
envlist = ansible-2.{15,16,17}
|
||||
minversion = 4.2.4
|
||||
{% if tox_ansible_versions is defined %}
|
||||
envlist = py3-ansible{% raw %}{{% endraw %}{% for version in tox_ansible_versions %}{{ version }}{% if not loop.last %},{% endif %}{% endfor %}{% raw %}}{% endraw %}
|
||||
{% else %}
|
||||
# Ansible 7 is disabled, causing issues with Fedora:
|
||||
# https://github.com/ansible/ansible/issues/81199#event-9773321055
|
||||
# envlist = py3-ansible{7,8,9}
|
||||
envlist = py3-ansible{8,9}
|
||||
{% endif %}
|
||||
|
||||
skipsdist = true
|
||||
|
||||
[testenv]
|
||||
deps =
|
||||
-rrequirements.txt
|
||||
ansible7: ansible == 7.*
|
||||
ansible8: ansible == 8.*
|
||||
ansible9: ansible == 9.*
|
||||
commands = molecule test
|
||||
|
||||
setenv =
|
||||
TOX_ENVNAME={envname}
|
||||
PY_COLORS=1
|
||||
ANSIBLE_FORCE_COLOR=1
|
||||
ANSIBLE_ROLES_PATH=../
|
||||
|
||||
passenv = *
|
||||
|
||||
# Test supported releases of ansible-core. See:
|
||||
# https://docs.ansible.com/ansible/latest/reference_appendices/release_and_maintenance.html#ansible-core-support-matrix
|
||||
|
||||
[testenv:ansible-2.15]
|
||||
basepython = python3.9
|
||||
deps =
|
||||
-rrequirements.txt
|
||||
ansible-core==2.15.*
|
||||
ansible-lint==6.*
|
||||
|
||||
[testenv:ansible-2.16]
|
||||
basepython = python3.10
|
||||
deps =
|
||||
-rrequirements.txt
|
||||
ansible-core==2.16.*
|
||||
ansible-lint==24.*
|
||||
|
||||
[testenv:ansible-2.17]
|
||||
basepython = python3.10
|
||||
deps =
|
||||
-rrequirements.txt
|
||||
ansible-core==2.17.*
|
||||
ansible-lint==24.*
|
||||
|
||||
# Future work, not releases, just prepared. See:
|
||||
# https://docs.ansible.com/ansible/devel//roadmap/ROADMAP_2_18.html
|
||||
# Note: enable python3.13 in `vars/main.yml` as well.
|
||||
# [testenv:ansible-2.18]
|
||||
# basepython = python3.13
|
||||
# deps =
|
||||
# -rrequirements.txt
|
||||
# ansible-core==2.18.*
|
||||
# ansible-lint==24.*
|
||||
passenv =
|
||||
namespace
|
||||
image
|
||||
tag
|
||||
DOCKER_HOST
|
||||
{% if github_variables_mapping is defined %}
|
||||
{% for item in github_variables_mapping %}
|
||||
{{ item.variable }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
|
|
|||
106
vars/main.yml
106
vars/main.yml
|
|
@ -1,12 +1,6 @@
|
|||
---
|
||||
# Setting to generate files.
|
||||
|
||||
# A list of python version to test.
|
||||
default_python_version:
|
||||
- "python:3.9"
|
||||
- "python:3.10"
|
||||
# - "python:3:13"
|
||||
|
||||
# A map that relates the `meta/main.yml` - `galaxy_info.platforms.name` to a name of a container.
|
||||
platform_image_mapping:
|
||||
Alpine: alpine
|
||||
|
|
@ -25,7 +19,7 @@ image_docker_hub_url_mapping:
|
|||
archlinux: "https://hub.docker.com/r/{{ docker_namespace }}/archlinux"
|
||||
debian: "https://hub.docker.com/r/{{ docker_namespace }}/debian"
|
||||
el: "https://hub.docker.com/r/{{ docker_namespace }}/enterpriselinux"
|
||||
fedora: "https://hub.docker.com/r/{{ docker_namespace }}/fedora"
|
||||
fedora: "https://hub.docker.com/r/{{ docker_namespace }}/fedora/"
|
||||
opensuse: "https://hub.docker.com/r/{{ docker_namespace }}/opensuse"
|
||||
ubuntu: "https://hub.docker.com/r/{{ docker_namespace }}/ubuntu"
|
||||
|
||||
|
|
@ -37,7 +31,10 @@ distribution_version_mapping:
|
|||
- latest
|
||||
Amazon:
|
||||
all:
|
||||
- 1
|
||||
- latest
|
||||
"2018.03":
|
||||
- 1
|
||||
Candidate:
|
||||
- latest
|
||||
Archlinux:
|
||||
|
|
@ -45,43 +42,52 @@ distribution_version_mapping:
|
|||
- latest
|
||||
Debian:
|
||||
all:
|
||||
- latest # 12
|
||||
- bullseye # 11
|
||||
- latest
|
||||
- bullseye
|
||||
bullseye:
|
||||
- bullseye
|
||||
bookworm:
|
||||
- latest
|
||||
buster:
|
||||
- buster
|
||||
bookworm:
|
||||
- latest
|
||||
EL:
|
||||
all:
|
||||
- 7
|
||||
- 8
|
||||
- latest
|
||||
"7":
|
||||
- 7
|
||||
"8":
|
||||
- 8
|
||||
"9":
|
||||
- latest
|
||||
Fedora:
|
||||
all:
|
||||
- 39
|
||||
- 38
|
||||
- latest
|
||||
- rawhide
|
||||
"37":
|
||||
- 37
|
||||
"38":
|
||||
- 38
|
||||
"39":
|
||||
- 39
|
||||
"40":
|
||||
- latest
|
||||
"41":
|
||||
"40":
|
||||
- rawhide
|
||||
opensuse:
|
||||
all:
|
||||
- latest
|
||||
Ubuntu:
|
||||
all:
|
||||
- latest # 24
|
||||
- jammy # 22
|
||||
- focal # 20
|
||||
noble:
|
||||
- latest
|
||||
- focal
|
||||
- bionic
|
||||
jammy:
|
||||
- jammy
|
||||
- latest
|
||||
focal:
|
||||
- focal
|
||||
bionic:
|
||||
- bionic
|
||||
|
||||
# To schedule CI on different days of the month, this is a map that relates a letter to a day of the month.
|
||||
letter_day_mapping:
|
||||
|
|
@ -111,16 +117,16 @@ letter_day_mapping:
|
|||
x: 24
|
||||
y: 25
|
||||
z: 26
|
||||
"0": 27
|
||||
"1": 27
|
||||
"2": 27
|
||||
"3": 27
|
||||
"4": 27
|
||||
"5": 27
|
||||
"6": 27
|
||||
"7": 27
|
||||
"8": 27
|
||||
"9": 27
|
||||
0: 27
|
||||
1: 27
|
||||
2: 27
|
||||
3: 27
|
||||
4: 27
|
||||
5: 27
|
||||
6: 27
|
||||
7: 27
|
||||
8: 27
|
||||
9: 27
|
||||
|
||||
# To schedule CI on different hours of the day, this is a map that relates a letter to an hour of the day.
|
||||
letter_hour_mapping:
|
||||
|
|
@ -150,16 +156,16 @@ letter_hour_mapping:
|
|||
x: 22
|
||||
y: 22
|
||||
z: 22
|
||||
"0": 23
|
||||
"1": 23
|
||||
"2": 23
|
||||
"3": 23
|
||||
"4": 23
|
||||
"5": 23
|
||||
"6": 23
|
||||
"7": 23
|
||||
"8": 23
|
||||
"9": 23
|
||||
0: 23
|
||||
1: 23
|
||||
2: 23
|
||||
3: 23
|
||||
4: 23
|
||||
5: 23
|
||||
6: 23
|
||||
7: 23
|
||||
8: 23
|
||||
9: 23
|
||||
|
||||
# To schedule CI on different days of the month, this is a map that relates a letter to a minute of the hour.
|
||||
letter_minute_mapping:
|
||||
|
|
@ -189,13 +195,13 @@ letter_minute_mapping:
|
|||
x: 47
|
||||
y: 49
|
||||
z: 51
|
||||
"0": 53
|
||||
"1": 55
|
||||
"2": 57
|
||||
"3": 59
|
||||
"4": 59
|
||||
"5": 59
|
||||
"6": 59
|
||||
"7": 59
|
||||
"8": 59
|
||||
"9": 59
|
||||
0: 53
|
||||
1: 55
|
||||
2: 57
|
||||
3: 59
|
||||
4: 59
|
||||
5: 59
|
||||
6: 59
|
||||
7: 59
|
||||
8: 59
|
||||
9: 59
|
||||
|
|
|
|||
Loading…
Reference in New Issue