28 Commits

Author SHA1 Message Date
cb1a475afb fix(ci): Added alma9 👷
All checks were successful
CI / lint (push) Successful in 27s
CI / Molecule Test (almalinux8) (push) Successful in 1m39s
CI / Molecule Test (almalinux9) (push) Successful in 2m3s
CI / release (push) Successful in 23s
CI / notify (push) Successful in 6s
2024-08-18 22:03:57 +12:00
babfb027db fix: EL8+ uses same template file 🎨 2024-08-18 21:56:06 +12:00
f1c5916252 fix: Use plugin from organisation 💚
All checks were successful
CI / lint (push) Successful in 18s
CI / Molecule Test (almalinux8) (push) Successful in 1m32s
CI / release (push) Successful in 15s
CI / notify (push) Successful in 5s
2024-08-18 11:56:46 +12:00
0a2c371969 fix: Add pre-task for removal of epel-release 💚
Some checks failed
CI / lint (push) Successful in 18s
CI / Molecule Test (almalinux8) (push) Successful in 1m37s
CI / release (push) Failing after 40s
CI / notify (push) Has been skipped
2024-08-18 11:44:24 +12:00
4a0ba94b38 fix: Remove EPEL if present on image 👷
Some checks failed
CI / lint (push) Successful in 28s
CI / Molecule Test (almalinux8) (push) Failing after 47s
CI / release (push) Has been skipped
CI / notify (push) Has been skipped
2024-08-18 11:02:04 +12:00
01d9a66e70 fix: Dropped almalinux 9 🚧
Some checks failed
CI / lint (push) Successful in 14s
CI / Molecule Test (almalinux8) (push) Failing after 42s
CI / release (push) Has been skipped
CI / notify (push) Has been skipped
2024-08-18 10:28:42 +12:00
69058ae0aa fix: Update testing image 💚
Some checks failed
CI / lint (push) Successful in 12s
CI / Molecule Test (almalinux8) (push) Failing after 1m0s
CI / Molecule Test (almalinux9) (push) Failing after 56s
CI / release (push) Has been skipped
CI / notify (push) Has been skipped
2024-08-18 10:13:22 +12:00
8798f58633 fix: Use batteries included ansible 💚
Some checks failed
CI / lint (push) Successful in 46s
CI / Molecule Test (almalinux8) (push) Successful in 1m28s
CI / Molecule Test (almalinux9) (push) Failing after 21s
CI / release (push) Has been skipped
CI / notify (push) Has been skipped
2024-08-18 10:06:14 +12:00
3ebcd4669d fix: use fqcn for ini_file 💚
Some checks failed
CI / lint (push) Successful in 12s
CI / Molecule Test (almalinux8) (push) Failing after 48s
CI / Molecule Test (almalinux9) (push) Failing after 38s
CI / release (push) Has been skipped
CI / notify (push) Has been skipped
2024-08-18 09:57:21 +12:00
c2bde188aa chore: Removed woodpecker config
Some checks failed
CI / lint (push) Successful in 12s
CI / Molecule Test (almalinux8) (push) Failing after 1m8s
CI / Molecule Test (almalinux9) (push) Failing after 41s
CI / release (push) Has been skipped
CI / notify (push) Has been skipped
2024-08-18 09:49:20 +12:00
6223231427 ci: Exclude role-name
Some checks failed
CI / lint (push) Failing after 13s
CI / Molecule Test (almalinux8) (push) Has been skipped
CI / Molecule Test (almalinux9) (push) Has been skipped
CI / release (push) Has been skipped
CI / notify (push) Has been skipped
2024-08-18 09:32:50 +12:00
7410073604 ci: Added ansible-lint config 👷
Some checks failed
CI / lint (push) Failing after 13s
CI / Molecule Test (almalinux8) (push) Has been skipped
CI / Molecule Test (almalinux9) (push) Has been skipped
CI / release (push) Has been skipped
CI / notify (push) Has been skipped
2024-08-18 09:30:56 +12:00
6d9655adab fix: Updated CI Workflow 💚
Some checks failed
CI / lint (push) Failing after 48s
CI / Molecule Test (almalinux8) (push) Has been skipped
CI / Molecule Test (almalinux9) (push) Has been skipped
CI / release (push) Has been skipped
CI / notify (push) Has been skipped
2024-08-18 08:03:09 +12:00
2e1b0d818f Delete .travis.yml
Some checks failed
Molecule Test / build (almalinux8) (push) Failing after 1m10s
Molecule Test / build (centos7) (push) Failing after 4s
Molecule Test / build (centos8) (push) Failing after 3s
2024-08-17 22:21:08 +12:00
817d9ba685 Retire CentOS 8 2023-08-19 23:13:56 +12:00
47a52b92dd Baseurl is still present and should be 2023-08-19 22:38:57 +12:00
92b972c24a Tag instance with distro 2023-08-19 22:15:27 +12:00
ed7fdb9b36 Attach docker socket 2023-08-19 22:05:32 +12:00
d6184ff9d0 pull image 2023-08-19 21:41:45 +12:00
fbc0cbf512 update meta 2023-08-19 17:08:01 +12:00
e44325bbe3 debug 2023-08-19 17:07:45 +12:00
6986b32b13 role name skip :) 2023-08-19 17:03:30 +12:00
8750e7f9c4 Add in YAML exeption 2023-08-19 16:55:54 +12:00
959d43c869 Get matrix working 2023-08-19 16:47:43 +12:00
69d831768c no matrix 2023-08-19 16:39:43 +12:00
6edeef81b6 update CI 2023-08-19 16:37:54 +12:00
20d93a4efb Added woodpecker config 2023-08-19 16:30:56 +12:00
ad9a18ca20 Install EPEL from URL 2021-05-06 09:46:31 +12:00
18 changed files with 326 additions and 118 deletions

7
.ansible-lint Normal file
View File

@@ -0,0 +1,7 @@
profile: min
skip_list: # or 'skip_list' to silence them completely
- experimental # all rules tagged as experimental
- unnamed-task # All tasks should be named
- fqcn-builtins
- role-name

116
.github/workflows/CI.yml vendored Normal file
View File

@@ -0,0 +1,116 @@
name: CI
on:
push:
branches:
- "**"
tags:
- "!**"
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
cache: 'pip' # caching pip dependencies
- name: Ensure requirements are installed
run: pip install -r requirements.txt
- name: Lint with ansible-lint
run: ansible-lint --exclude ./tests -c ".ansible-lint"
env:
PY_COLORS: '1'
ANSIBLE_FORCE_COLOR: '1'
- name: Lint with yamllint
run: yamllint .
env:
PY_COLORS: '1'
ANSIBLE_FORCE_COLOR: '1'
molecule:
name: Molecule Test
runs-on: ubuntu-latest
needs: lint
strategy:
fail-fast: true
matrix:
os: [almalinux8, almalinux9]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
cache: 'pip' # caching pip dependencies
- name: Ensure requirements are installed
run: pip install -r requirements.txt
- name: Run Molecule tests.
run: molecule test
env:
PY_COLORS: '1'
ANSIBLE_FORCE_COLOR: '1'
MOLECULE_DISTRO: ${{ matrix.os }}
release:
runs-on: ubuntu-latest
needs:
- lint
- molecule
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.22'
# - name: Install gitea provider for Go Semantic Release
# run: |
# mkdir -p .semrel/$(go env GOOS)_$(go env GOARCH)/provider-gitea/${GITEA_PROVIDER_VER}/ && \
# wget https://github.com/cybercinch/go-semantic-release-provider-gitea/releases/download/v${GITEA_PROVIDER_VER}/go-semantic-release-provider-gitea_v${GITEA_PROVIDER_VER}_linux_amd64 \
# -O .semrel/$(go env GOOS)_$(go env GOARCH)/provider-gitea/${GITEA_PROVIDER_VER}/gitea && \
# chmod a+x .semrel/$(go env GOOS)_$(go env GOARCH)/provider-gitea/${GITEA_PROVIDER_VER}/gitea
# env:
# GITEA_PROVIDER_VER: 1.0.11
- run: |
echo "github repo: ${GITHUB_REPOSITORY}"
echo "env vars: $(env)"
- uses: go-semantic-release/action@v1
with:
custom-arguments: --provider=gitea
env:
GITEA_TOKEN: ${{ secrets.G_TOKEN }}
GITEA_HOST: ${{ secrets.G_SERVER_URL}}
notify:
runs-on: ubuntu-latest
needs:
- lint
- molecule
- release
steps:
- name: ntfy-success-notifications
uses: niniyas/ntfy-action@master
if: success()
with:
url: '${{ vars.NTFY_URL }}'
title: Workflow success - ansible-role-repo-epel
topic: 'ci-status'
priority: 4
tags: +1,partying_face,action,successfully,completed
details: Workflow has been successfully completed!
icon: 'https://styles.redditmedia.com/t5_32uhe/styles/communityIcon_xnt6chtnr2j21.png'
image: true
- name: ntfy-failed-notifications
uses: niniyas/ntfy-action@master
if: failure()
with:
url: '${{ vars.NTFY_URL }}'
title: Workflow failed - ansible-role-repo-epel
topic: 'ci-status'
priority: 5
tags: -1,skull,action,failed
details: Workflow has failed!
actions: 'default'

View File

@@ -1,36 +0,0 @@
---
name: Molecule Test
on:
push:
branches:
- 'main'
tags-ignore:
- 'v*'
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
max-parallel: 4
matrix:
molecule_distro: ['centos7', 'centos8', 'almalinux8' ]
env:
ANSIBLE_CALLBACK_WHITELIST: profile_tasks
steps:
- name: Checout Source
uses: actions/checkout@v1
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install --upgrade molecule['docker'] docker 'ansible==2.9.19'
- name: Test with molecule
run: |
molecule test --all
env:
MOLECULE_DISTRO: ${{ matrix.molecule_distro }}
EPEL_MIRROR_URL: https://pproxy.guise.net.nz/epel

View File

@@ -1,16 +0,0 @@
name: Create a new release on github
on:
push:
tags:
- '*'
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Create GitHub release
uses: Roang-zero1/github-create-release-action@master
with:
version_regex: ^v[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+
update_existing: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -1,29 +0,0 @@
---
language: python
python: "2.7"
# Use the new container infrastructure
sudo: false
# Install ansible
addons:
apt:
packages:
- python-pip
install:
# Install ansible
- pip install ansible
# Check ansible version
- ansible --version
# Create ansible.cfg with correct roles_path
- printf '[defaults]\nroles_path=../' >ansible.cfg
script:
# Basic role syntax check
- ansible-playbook tests/test.yml -i tests/inventory --syntax-check
notifications:
webhooks: https://galaxy.ansible.com/api/v1/notifications/

View File

@@ -1,6 +1,9 @@
---
# Based on ansible-lint config
extends: default
skip_list:
- fqcn-builtins
- role-name
rules:
braces:

View File

@@ -1,4 +1,8 @@
---
# defaults file for repo-epel
epel_repo_url: "https://dl.fedoraproject.org/pub/epel/epel-release-latest-{{ ansible_distribution_major_version }}.noarch.rpm"
epel_repo_gpg_key_url: "https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-{{ ansible_distribution_major_version }}"
epel_repofile_path: "/etc/yum.repos.d/epel.repo"
epel_repo_disable: false
epel_specify_mirror: false
epel_mirror_url: http://download.fedoraproject.org/pub/epel

View File

@@ -1,5 +1,7 @@
galaxy_info:
author: your name
namespace: guisea
role_name: role-repo-epel
description: your role description
company: your company (optional)

View File

@@ -1,7 +1,34 @@
---
- name: Converge
hosts: all
pre_tasks:
- name: Check if cleanup is completed already
ansible.builtin.stat:
path: /etc/epel-cleanup
register: cleanup
- name: Ensure EPEL is not present
yum:
name: epel-release
disablerepo:
- epel
state: absent
when: not cleanup.stat.exists
changed_when: false
- name: Remove any traces of EPEL
shell: rm -f /etc/yum.repos.d/epel*
when: not cleanup.stat.exists
changed_when: false
- name: Create file confirming cleanup
file:
path: /etc/epel-cleanup
state: touch
when: not cleanup.stat.exists
changed_when: false
tasks:
- name: "Include repo-epel"
include_role:
name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"

View File

@@ -4,9 +4,10 @@ dependency:
driver:
name: docker
platforms:
- name: instance
image: docker.io/guisea/${MOLECULE_DISTRO:-centos8}:latest
- name: instance-${MOLECULE_DISTRO:-centos7}
image: "cybercinch/docker-${MOLECULE_DISTRO:-almalinux8}-ansible:latest"
pre_build_image: true
role_name_check: 2
provisioner:
name: ansible
verifier:

View File

@@ -5,32 +5,33 @@
hosts: all
tasks:
- name: Retrieve yum repofile
shell: cat /etc/yum.repos.d/epel.repo
ansible.builtin.shell: cat /etc/yum.repos.d/epel.repo
ignore_errors: true
register: repofile
- debug:
- name: Output repofile
ansible.builtin.debug:
var: repofile
- name: metalink is present
assert:
- name: Metalink is present
ansible.builtin.assert:
that:
- "'metalink=' in repofile.stdout"
- name: baseurl is not defined
assert:
that:
- "'baseurl=' not in repofile.stdout"
# - name: baseurl is not defined
# assert:
# that:
# - "'baseurl=' not in repofile.stdout"
- name: try to install htop from EPEL
package:
- name: Try to install htop from EPEL
ansible.builtin.package:
name: htop
state: latest
state: installed
- name: Gather the rpm package facts
package_facts:
ansible.builtin.package_facts:
manager: auto
- name: is htop actually installed?
assert:
- name: Is htop actually installed?
ansible.builtin.assert:
that: "'htop' in ansible_facts.packages"

View File

@@ -1,6 +1,33 @@
---
- name: Converge
hosts: all
pre_tasks:
- name: Check if cleanup is completed already
ansible.builtin.stat:
path: /etc/epel-cleanup
register: cleanup
- name: Ensure EPEL is not present
yum:
name: epel-release
disablerepo:
- epel
state: absent
when: not cleanup.stat.exists
changed_when: false
- name: Remove any traces of EPEL
shell: rm -f /etc/yum.repos.d/epel*
when: not cleanup.stat.exists
changed_when: false
- name: Create file confirming cleanup
file:
path: /etc/epel-cleanup
state: touch
when: not cleanup.stat.exists
changed_when: false
tasks:
- name: "Include repo-almalinux"
include_role:

View File

@@ -4,10 +4,11 @@ dependency:
driver:
name: docker
platforms:
- name: instance
image: docker.io/guisea/${MOLECULE_DISTRO:-centos8}:latest
- name: instance-${MOLECULE_DISTRO:-centos7}
image: docker.io/guisea/${MOLECULE_DISTRO:-centos7}:latest
pre_build_image: true
provisioner:
name: ansible
verifier:
name: ansible
name: ansible
role_name_check: 2

6
requirements.txt Normal file
View File

@@ -0,0 +1,6 @@
ansible-compat >= 4
molecule[docker]== 24.2.1
ansible-lint==24.2.2
yamllint==1.35.1
passlib==1.7.4
ansible<10.0.0

View File

@@ -1,9 +1,39 @@
---
# tasks file for repo-epel
- name: Ensure EPEL is installed
package:
name: epel-release
- name: Check if EPEL repo is already configured.
stat:
path: "{{ epel_repofile_path }}"
register: epel_repofile_result
- name: Import EPEL GPG key.
rpm_key:
key: "{{ epel_repo_gpg_key_url }}"
state: present
register: result
until: result is succeeded
retries: 5
delay: 10
when: not epel_repofile_result.stat.exists
ignore_errors: "{{ ansible_check_mode }}"
- name: Install EPEL repo.
yum:
name: "{{ epel_repo_url }}"
state: present
register: result
until: result is succeeded
retries: 5
delay: 10
when: not epel_repofile_result.stat.exists
- name: Disable Main EPEL repo.
community.general.ini_file:
path: "/etc/yum.repos.d/epel.repo"
section: epel
option: enabled
value: 0
mode: 0644
when: epel_repo_disable
- name: Configure Repository Settings (EL7)
template:
@@ -14,21 +44,19 @@
dest: /etc/yum.repos.d/epel.repo
- src: el7-epel-testing.repo.j2
dest: /etc/yum.repos.d/epel-testing.repo
when: ansible_os_family == "RedHat" and ansible_distribution_major_version == "7"
when:
- epel_specify_mirror
- ansible_os_family == "RedHat" and ansible_distribution_major_version == "7"
- name: Configure Repository Settings (EL8)
- name: Configure Repository Settings (EL8+))
template:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
with_items:
- src: el8-epel.repo.j2
- src: epel.repo.j2
dest: /etc/yum.repos.d/epel.repo
- src: el8-epel-modular.repo.j2
dest: /etc/yum.repos.d/epel-modular.repo
- src: el8-epel-playground.repo.j2
dest: /etc/yum.repos.d/epel-playground.repo
- src: el8-epel-testing.repo.j2
- src: epel-testing.repo.j2
dest: /etc/yum.repos.d/epel-testing.repo
- src: el8-epel-testing-modular.repo.j2
dest: /etc/yum.repos.d/epel-testing-modular.repo
when: ansible_os_family == "RedHat" and ansible_distribution_major_version == "8"
when:
- epel_specify_mirror
- ansible_os_family == "RedHat" and ansible_distribution_major_version == "8"

View File

@@ -1,6 +1,6 @@
[epel]
name=Extra Packages for Enterprise Linux $releasever - $basearch
{% if epel_specify_mirror is sameas true %}
{% if epel_specify_mirror %}
baseurl={{ epel_mirror_url }}/$releasever/Everything/$basearch
{% else %}
metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-$releasever&arch=$basearch&infra=$infra&content=$contentdir
@@ -12,7 +12,7 @@ gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-8
[epel-debuginfo]
name=Extra Packages for Enterprise Linux $releasever - $basearch - Debug
{% if epel_specify_mirror is sameas true %}
{% if epel_specify_mirror %}
baseurl={{ epel_mirror_url }}/$releasever/Everything/$basearch/debug
{% else %}
metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-debug-$releasever&arch=$basearch&infra=$infra&content=$contentdir
@@ -23,7 +23,7 @@ gpgcheck=1
[epel-source]
name=Extra Packages for Enterprise Linux $releasever - $basearch - Source
{% if epel_specify_mirror is sameas true %}
{% if epel_specify_mirror %}
baseurl={{ epel_mirror_url }}/$releasever/Everything/SRPMS
{% else %}
metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-source-$releasever&arch=$basearch&infra=$infra&content=$contentdir

View File

@@ -0,0 +1,33 @@
[epel-testing]
name=Extra Packages for Enterprise Linux $releasever - Testing - $basearch
{% if epel_specify_mirror is sameas true %}
baseurl={{ epel_mirror_url }}/testing/$releasever/Everything/$basearch
{% else %}
metalink=https://mirrors.fedoraproject.org/metalink?repo=testing-epel$releasever&arch=$basearch&infra=$infra&content=$contentdir
{% endif %}
enabled=0
gpgcheck=1
countme=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-{{ ansible_distribution_major_version}}
[epel-testing-debuginfo]
name=Extra Packages for Enterprise Linux $releasever - Testing - $basearch - Debug
{% if epel_specify_mirror is sameas true %}
baseurl={{ epel_mirror_url }}/testing/$releasever/Everything/$basearch/debug
{% else %}
metalink=https://mirrors.fedoraproject.org/metalink?repo=testing-debug-epel$releasever&arch=$basearch&infra=$infra&content=$contentdir
{% endif %}
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-{{ ansible_distribution_major_version}}
gpgcheck=1
[epel-testing-source]
name=Extra Packages for Enterprise Linux $releasever - Testing - $basearch - Source
{% if epel_specify_mirror is sameas true %}
baseurl={{ epel_mirror_url }}/testing/$releasever/Everything/SRPMS
{% else %}
metalink=https://mirrors.fedoraproject.org/metalink?repo=testing-source-epel$releasever&arch=$basearch&infra=$infra&content=$contentdir
{% endif %}
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-{{ ansible_distribution_major_version}}
gpgcheck=1

33
templates/epel.repo.j2 Normal file
View File

@@ -0,0 +1,33 @@
[epel]
name=Extra Packages for Enterprise Linux $releasever - $basearch
{% if epel_specify_mirror is sameas true %}
baseurl={{ epel_mirror_url }}/$releasever/Everything/$basearch
{% else %}
metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-$releasever&arch=$basearch&infra=$infra&content=$contentdir
{% endif %}
enabled=1
gpgcheck=1
countme=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-{{ ansible_distribution_major_version }}
[epel-debuginfo]
name=Extra Packages for Enterprise Linux $releasever - $basearch - Debug
{% if epel_specify_mirror is sameas true %}
baseurl={{ epel_mirror_url }}/$releasever/Everything/$basearch/debug
{% else %}
metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-debug-$releasever&arch=$basearch&infra=$infra&content=$contentdir
{% endif %}
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-{{ ansible_distribution_major_version }}
gpgcheck=1
[epel-source]
name=Extra Packages for Enterprise Linux $releasever - $basearch - Source
{% if epel_specify_mirror %}
baseurl={{ epel_mirror_url }}/$releasever/Everything/SRPMS
{% else %}
metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-source-$releasever&arch=$basearch&infra=$infra&content=$contentdir
{% endif %}
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-{{ ansible_distribution_major_version }}
gpgcheck=1