Why Semaphore?

Running Ansible from the terminal works, but Semaphore adds:

  • Visual dashboard — See all playbook runs, their status, and logs.
  • One-click execution — No need to SSH into a server and type commands.
  • Scheduling — Cron-like scheduling for recurring playbooks.
  • RBAC — Give team members access without sharing SSH keys.
  • Audit trail — Full execution history with timestamps and output.

Prerequisites

  • Docker or a Go binary + database (PostgreSQL/MySQL/SQLite).
  • An existing Ansible playbook in a Git repository.
  • SSH access from the Semaphore server to managed hosts.

Step 1: Deploy with Docker Compose

# docker-compose.yml
version: "3"
services:
  semaphore:
    image: semaphoreui/semaphore:latest
    container_name: semaphore
    environment:
      SEMAPHORE_DB_DIALECT: bolt
      SEMAPHORE_ADMIN_PASSWORD: admin123
      SEMAPHORE_ADMIN_NAME: admin
      SEMAPHORE_ADMIN_EMAIL: admin@example.com
      SEMAPHORE_ADMIN: admin
    ports:
      - "3000:3000"
    volumes:
      - ./semaphore-data:/etc/semaphore
    restart: always
docker compose up -d

Access at http://your-server:3000. Log in with the admin credentials.


Step 2: Configure Key Store

  1. Go to Key StoreNew Key.
  2. Add your SSH private key (for connecting to managed hosts).
  3. Add any sudo/become passwords as “Login with password” type keys.
  4. These credentials are stored encrypted and referenced by task templates.

Step 3: Add a Git Repository

  1. Go to RepositoriesNew Repository.
  2. Name: e.g., “Infrastructure Playbooks”
  3. URL: git@github.com:your-org/ansible-playbooks.git
  4. Branch: main
  5. SSH Key: Select the key from your Key Store.

Step 4: Create an Inventory

  1. Go to InventoryNew Inventory.
  2. Choose Static or File (from the Git repo).
  3. For Static, paste your inventory in INI or YAML format:
[webservers]
web1.example.com
web2.example.com

[databases]
db1.example.com

Step 5: Create and Run a Task Template

  1. Go to Task TemplatesNew Template.
  2. Playbook Filename: site.yml (path relative to the repository root).
  3. Repository: Select your repository.
  4. Inventory: Select your inventory.
  5. Environment: Add any extra variables (JSON format).
  6. Schedule: (Optional) Set a cron expression for automatic runs.
  7. Click Run to execute immediately.

Troubleshooting

ProblemSolution
Playbook fails but works from CLIAdd SSH keys and sudo passwords in Key Store; check environment variables
”Repository not accessible”Verify Git URL and SSH key; test git clone manually from the Semaphore server
Task stuck in “waiting”Check that the Semaphore worker is running; restart the container
Permission denied on managed hostsEnsure the SSH key in Key Store matches the authorized_keys on target hosts
Schedule not triggeringVerify cron expression syntax; check Semaphore logs for scheduler errors

Summary

  • Semaphore is a lightweight AWX alternative — single binary, 256 MB RAM.
  • Use the Key Store for SSH keys and passwords.
  • Schedule playbooks with cron expressions for automated infrastructure management.
  • Check execution logs in the Semaphore UI for debugging failed runs.