Trigger Semaphore Setup Workflow

📖 Purpose

This workflow ensures that the Setup Semaphore task inside the Home Lab project in Semaphore UI is automatically executed whenever relevant inventory changes are committed. Instead of running the setup_semaphoreui.yml playbook locally, this workflow delegates execution to Semaphore, keeping configuration application centralized, consistent, and environment‑controlled.

Whenever files under inventory/semaphore/group_vars/semaphore/ are modified, the workflow runs the reusable [scripts/semaphore_trigger.py](https://github.com/t3knoid/ansible/tree/main/scripts/execute_semaphoreui_setup.py] script, which authenticates with Semaphore UI, locates the correct project and task template, and triggers a new execution.


🛠 Workflow File

Located at: .github/workflows/trigger-semaphoreui-setup.yml

name: Trigger Semaphore "Setup Semaphore" Task

on:
  push:
    paths:
      - "inventory/semaphore/group_vars/semaphore/**"

jobs:
  trigger-semaphore-task:
    runs-on: ubuntu-latest

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

      # Set up Python
      - name: Set up Python
        uses: actions/setup-python@v5
        with:
          python-version: "3.12"

      # Install dependencies
      - name: Install dependencies
        run: |
          python -m pip install --upgrade pip
          pip install requests

      # Execute the Semaphore trigger script
      - name: Trigger Semaphore task
        env:
          SEMAPHORE_URL: "https://semaphore.refol.us/api"
          SEMAPHORE_TOKEN: ${{ secrets.SEMAPHORE_API_TOKEN }}
          PROJECT_NAME: "Home Lab"
          TEMPLATE_NAME: "Setup Semaphore"
        run: |
          python scripts/execute_semaphoreui_setup.py

🔑 Key Points