Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .github/docker/fedora-ansible-43.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM fedora:43

# Update all packages
RUN dnf -y upgrade

# Install Python and Ansible (system packages)
RUN dnf -y install \
python3 \
python3-pip \
ansible

# Clean up dnf caches to reduce image size
RUN dnf clean all && rm -rf /var/cache/dnf

WORKDIR /workspace
84 changes: 84 additions & 0 deletions .github/workflows/ansible-site-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: Ansible Site Test

on:
workflow_dispatch:
push:
paths:
- 'ansible/**'
- 'site.yml'
- '.github/workflows/ansible-site-test.yml'
pull_request:
paths:
- 'ansible/**'
- 'site.yml'
- '.github/workflows/ansible-site-test.yml'

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build-ansible-base-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
outputs:
image_name_lower: ${{ steps.lowercase.outputs.IMAGE_NAME_LOWER }}

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set image name to lowercase
id: lowercase
run: echo "IMAGE_NAME_LOWER=${IMAGE_NAME,,}" >> $GITHUB_OUTPUT

- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ steps.lowercase.outputs.IMAGE_NAME_LOWER }}/fedora-ansible-43-ansible
tags: |
type=raw,value=latest
type=sha,format=long

- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
file: .github/docker/fedora-ansible-43.Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

ansible-site-test:
needs: build-ansible-base-image
runs-on: ubuntu-latest
permissions:
contents: read
packages: read
container:
image: ghcr.io/${{ needs.build-ansible-base-image.outputs.image_name_lower }}/fedora-ansible-43-ansible:latest
credentials:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Ansible Galaxy collections
working-directory: ansible
run: ansible-galaxy collection install -r requirements.yml

- name: Run Ansible playbook
working-directory: ansible
run: ansible-playbook site.yml --syntax-check