Ansible Semaphore
Modern UI for Ansible automation.
Overview
Ansible Semaphore is a modern web-based UI that transforms how teams interact with Ansible automation. Originally created to address the complexity of managing Ansible playbooks, inventories, and execution logs across distributed teams, Semaphore provides a centralized interface that makes infrastructure automation accessible to both seasoned DevOps engineers and team members who prefer graphical interfaces over command-line tools. The platform offers role-based access control, scheduled task execution, and comprehensive audit trails that enterprise environments demand.
This stack combines Semaphore with PostgreSQL to create a robust automation management platform. PostgreSQL serves as the persistent data store for all Semaphore configurations, user accounts, execution histories, and audit logs. The relational database's ACID compliance ensures that critical automation data remains consistent, while its advanced querying capabilities enable Semaphore to efficiently retrieve execution statistics and generate detailed reports. PostgreSQL's proven reliability makes it ideal for production environments where automation failures could have significant business impact.
Development teams managing complex infrastructure, IT operations groups coordinating across multiple environments, and growing organizations transitioning from ad-hoc scripting to structured automation will benefit most from this deployment. The combination provides enterprise-grade features like user authentication, execution scheduling, and detailed logging while maintaining the flexibility to integrate with existing CI/CD pipelines and configuration management workflows.
Key Features
- Web-based playbook execution with real-time output streaming and color-coded status indicators
- Git repository integration for automatic playbook synchronization and version control
- Role-based access control with team management and permission granularity per project
- Scheduled task execution with cron-style scheduling and recurring job management
- Comprehensive audit logging stored in PostgreSQL with execution history and change tracking
- SSH key and credential management with encrypted storage in the database
- Multi-project workspace organization with isolated inventories and playbook collections
- RESTful API for integration with external systems and custom automation workflows
Common Use Cases
- 1DevOps teams managing application deployments across multiple environments with approval workflows
- 2System administrators coordinating server maintenance tasks and configuration updates
- 3Cloud infrastructure teams provisioning and decommissioning resources through standardized playbooks
- 4Development teams running automated testing and deployment pipelines triggered by code commits
- 5IT operations managing compliance auditing and reporting through scheduled configuration checks
- 6Managed service providers offering infrastructure automation services to multiple clients
- 7Educational institutions teaching infrastructure automation with a user-friendly interface
Prerequisites
- Minimum 2GB RAM for combined Semaphore and PostgreSQL operations with moderate playbook complexity
- Docker and Docker Compose installed with user permissions for container management
- Port 3000 available for Semaphore web interface access
- SSH key pairs generated for target host authentication in Ansible operations
- Basic understanding of Ansible playbook structure and inventory file formats
- Git repository access if using remote playbook sources for automation content
For development & testing. Review security settings, change default credentials, and test thoroughly before production use. See Terms
docker-compose.yml
docker-compose.yml
1services: 2 semaphore: 3 image: semaphoreui/semaphore:latest4 container_name: semaphore5 restart: unless-stopped6 environment: 7 SEMAPHORE_DB_USER: ${DB_USER}8 SEMAPHORE_DB_PASS: ${DB_PASSWORD}9 SEMAPHORE_DB_HOST: postgres10 SEMAPHORE_DB_PORT: 543211 SEMAPHORE_DB_DIALECT: postgres12 SEMAPHORE_DB: ${DB_NAME}13 SEMAPHORE_PLAYBOOK_PATH: /tmp/semaphore14 SEMAPHORE_ADMIN_PASSWORD: ${ADMIN_PASSWORD}15 SEMAPHORE_ADMIN_EMAIL: ${ADMIN_EMAIL}16 SEMAPHORE_ADMIN: admin17 ports: 18 - "3000:3000"19 depends_on: 20 - postgres21 networks: 22 - semaphore2324 postgres: 25 image: postgres:16-alpine26 container_name: semaphore-postgres27 environment: 28 POSTGRES_DB: ${DB_NAME}29 POSTGRES_USER: ${DB_USER}30 POSTGRES_PASSWORD: ${DB_PASSWORD}31 volumes: 32 - postgres_data:/var/lib/postgresql/data33 networks: 34 - semaphore3536volumes: 37 postgres_data: 3839networks: 40 semaphore: 41 driver: bridge.env Template
.env
1DB_NAME=semaphore2DB_USER=semaphore3DB_PASSWORD=changeme4ADMIN_EMAIL=admin@example.com5ADMIN_PASSWORD=changemeUsage Notes
- 1Docs: https://docs.ansible-semaphore.com/
- 2Access at http://localhost:3000 - login with ADMIN_EMAIL/ADMIN_PASSWORD
- 3Add Key Store for SSH keys, passwords, and secrets
- 4Create Inventory files for target hosts
- 5Add playbooks from Git repository or upload
- 6Schedule tasks and view execution history
Individual Services(2 services)
Copy individual services to mix and match with your existing compose files.
semaphore
semaphore:
image: semaphoreui/semaphore:latest
container_name: semaphore
restart: unless-stopped
environment:
SEMAPHORE_DB_USER: ${DB_USER}
SEMAPHORE_DB_PASS: ${DB_PASSWORD}
SEMAPHORE_DB_HOST: postgres
SEMAPHORE_DB_PORT: 5432
SEMAPHORE_DB_DIALECT: postgres
SEMAPHORE_DB: ${DB_NAME}
SEMAPHORE_PLAYBOOK_PATH: /tmp/semaphore
SEMAPHORE_ADMIN_PASSWORD: ${ADMIN_PASSWORD}
SEMAPHORE_ADMIN_EMAIL: ${ADMIN_EMAIL}
SEMAPHORE_ADMIN: admin
ports:
- "3000:3000"
depends_on:
- postgres
networks:
- semaphore
postgres
postgres:
image: postgres:16-alpine
container_name: semaphore-postgres
environment:
POSTGRES_DB: ${DB_NAME}
POSTGRES_USER: ${DB_USER}
POSTGRES_PASSWORD: ${DB_PASSWORD}
volumes:
- postgres_data:/var/lib/postgresql/data
networks:
- semaphore
Quick Start
terminal
1# 1. Create the compose file2cat > docker-compose.yml << 'EOF'3services:4 semaphore:5 image: semaphoreui/semaphore:latest6 container_name: semaphore7 restart: unless-stopped8 environment:9 SEMAPHORE_DB_USER: ${DB_USER}10 SEMAPHORE_DB_PASS: ${DB_PASSWORD}11 SEMAPHORE_DB_HOST: postgres12 SEMAPHORE_DB_PORT: 543213 SEMAPHORE_DB_DIALECT: postgres14 SEMAPHORE_DB: ${DB_NAME}15 SEMAPHORE_PLAYBOOK_PATH: /tmp/semaphore16 SEMAPHORE_ADMIN_PASSWORD: ${ADMIN_PASSWORD}17 SEMAPHORE_ADMIN_EMAIL: ${ADMIN_EMAIL}18 SEMAPHORE_ADMIN: admin19 ports:20 - "3000:3000"21 depends_on:22 - postgres23 networks:24 - semaphore2526 postgres:27 image: postgres:16-alpine28 container_name: semaphore-postgres29 environment:30 POSTGRES_DB: ${DB_NAME}31 POSTGRES_USER: ${DB_USER}32 POSTGRES_PASSWORD: ${DB_PASSWORD}33 volumes:34 - postgres_data:/var/lib/postgresql/data35 networks:36 - semaphore3738volumes:39 postgres_data:4041networks:42 semaphore:43 driver: bridge44EOF4546# 2. Create the .env file47cat > .env << 'EOF'48DB_NAME=semaphore49DB_USER=semaphore50DB_PASSWORD=changeme51ADMIN_EMAIL=admin@example.com52ADMIN_PASSWORD=changeme53EOF5455# 3. Start the services56docker compose up -d5758# 4. View logs59docker compose logs -fOne-Liner
Run this command to download and set up the recipe in one step:
terminal
1curl -fsSL https://docker.recipes/api/recipes/ansible-semaphore/run | bashTroubleshooting
- Database connection failed: Verify postgres container is running and SEMAPHORE_DB_HOST matches service name
- Semaphore admin login rejected: Check ADMIN_EMAIL and ADMIN_PASSWORD environment variables match login credentials
- Playbook execution fails with permission denied: Ensure SSH keys are properly added to Key Store and target hosts
- PostgreSQL container crashes on startup: Check available disk space and verify DB_PASSWORD meets complexity requirements
- Semaphore UI shows 'Database migration failed': Remove postgres_data volume and restart stack to reinitialize database
- Task execution hangs indefinitely: Verify target hosts are reachable and SSH keys have appropriate permissions
Community Notes
Loading...
Loading notes...
Download Recipe Kit
Get all files in a ready-to-deploy package
Includes docker-compose.yml, .env template, README, and license
Ad Space
Shortcuts: C CopyF FavoriteD Download