Skip to content

Create GitHub action image that can get on the Tailnet and interact with Homelab devices #18

@SRF-Audio

Description

@SRF-Audio

Title: Create Fedora 43 Ansible base image and GitHub Actions site.yml test job

Goal

Provide a reusable Fedora 43 base container for GitHub Actions, preinstalled with Python and Ansible, and a simple CI job that runs ansible/site.yml as a smoke test.


Base image requirements

Create a Dockerfile (e.g. ./.github/docker/fedora-ansible-43.Dockerfile) that:

  • Uses fedora:43 as the base image.

  • Runs dnf -y upgrade to update all packages.

  • Installs:

    • python3
    • python3-pip
    • ansible (Fedora package, not pip).
  • Cleans up dnf caches to keep the image small.

Publish this image to GHCR so Actions jobs can use it directly:

  • Image name: ghcr.io/<org>/<repo>/fedora-ansible-43-ansible:latest

  • Add a workflow job (e.g. build-ansible-base-image) that:

    • Logs into GHCR using GITHUB_TOKEN.
    • Builds from ./.github/docker/fedora-ansible-43.Dockerfile.
    • Tags and pushes the image to GHCR with latest (and optionally ${{ github.sha }}).

Test job requirements

Create a workflow .github/workflows/ansible-site-test.yml that:

  • Triggers on:

    • workflow_dispatch

    • pull_request and push that touch:

      • ansible/**
      • site.yml
      • .github/workflows/ansible-site-test.yml
  • Has two jobs:

  1. build-ansible-base-image

    • Runs on ubuntu-latest.
    • Builds and pushes the GHCR image described above.
    • Uses GITHUB_TOKEN for docker login.
  2. ansible-site-test

    • needs: build-ansible-base-image.

    • runs-on: ubuntu-latest.

    • Uses the GHCR image as the job container:

      • container.image: ghcr.io/<org>/<repo>/fedora-ansible-43-ansible:latest
    • Steps:

      1. Checkout the repo (actions/checkout).

      2. cd ansible and run:

        • ansible-playbook site.yml
    • Fail the job if ansible-playbook exits non-zero.


Acceptance criteria

  • Running the workflow on workflow_dispatch:

    • Builds and pushes the Fedora 43 Ansible base image to GHCR.
    • Starts the ansible-site-test job using that image.
    • Successfully runs ansible-playbook site.yml from the ansible directory.
  • Subsequent runs reuse the GHCR image without needing code changes.

Metadata

Metadata

Labels

No labels
No labels

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions