Ansible Semaphore
I've a home lab and with time my inventory has grown quite a bit. And I started automating some basic tasks using Ansible scripts. And it was great except for 2 things:
- Automating this to run automatically on a schedule.
- Have a GUI dashboard to review the runs.
And while this seems like a straight forward job, along with other requirements, one can easily recommend other tools like AWX. However most of these tools were too heavy or too loaded for my small home lab. And then I stumbled on this video.
And basically after watching this, I started another LXC container and put this docker-compose.yaml
in it:
volumes:
semaphore-mysql:
driver: local
services:
mysql:
image: mysql:8.0
hostname: mysql
container_name: mysql
volumes:
- semaphore-mysql:/var/lib/mysql
environment:
- MYSQL_RANDOM_ROOT_PASSWORD=yes
- MYSQL_DATABASE=semaphore
- MYSQL_USER=semaphore
- MYSQL_PASSWORD=semaphore # change!
restart: unless-stopped
#ports:
#- 3306:3306
semaphore:
container_name: ansiblesemaphore
image: semaphoreui/semaphore:v2.8.90
# user: "${UID}:${GID}"
ports:
- 3000:3000
environment:
- SEMAPHORE_DB_USER=semaphore
- SEMAPHORE_DB_PASS=semaphore # change!
- SEMAPHORE_DB_HOST=mysql
- SEMAPHORE_DB_PORT=3306
- SEMAPHORE_DB_DIALECT=mysql
- SEMAPHORE_DB=semaphore
- SEMAPHORE_PLAYBOOK_PATH=/tmp/semaphore/
- SEMAPHORE_ADMIN_PASSWORD=semaphore # change!
- SEMAPHORE_ADMIN_NAME=admin
- SEMAPHORE_ADMIN_EMAIL=hello@world.com # change!
- SEMAPHORE_ADMIN=admin
- SEMAPHORE_ACCESS_KEY_ENCRYPTION=semaphore # add to your access key encryption !
- ANSIBLE_HOST_KEY_CHECKING=false # (optional) change to true if you want to enable host key checking
volumes:
- ./inventory/:/inventory:ro
- ./authorized-keys/:/authorized-keys:ro
- ./config/:/etc/semaphore:rw
restart: unless-stopped
depends_on:
- mysql
With some small help from NGINX Proxy Manager you get this!
Great tool, deployable with such ease, is a rare story indeed.