Listing 1: Semaphore UI produktiv einrichten # docker-compose.yml – Produktives Setup services: postgres: image: postgres:16 environment: POSTGRES_USER: semaphore POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} POSTGRES_DB: semaphore volumes: - postgres-data:/var/lib/postgresql/data healthcheck: test: ["CMD-SHELL", "pg_isready -U semaphore"] interval: 10s retries: 5 semaphore: image: semaphoreui/semaphore:latest ports: - "3000:3000" environment: SEMAPHORE_DB_DIALECT: postgres SEMAPHORE_DB_HOST: postgres SEMAPHORE_DB_USER: semaphore SEMAPHORE_DB_PASS: ${POSTGRES_PASSWORD} SEMAPHORE_DB: semaphore SEMAPHORE_ADMIN: admin SEMAPHORE_ADMIN_PASSWORD: ${ADMIN_PASSWORD} SEMAPHORE_ADMIN_NAME: "Admin" SEMAPHORE_ADMIN_EMAIL: admin@example.com # PFLICHT: 32 Byte base64 - verloren = alle Secrets unbrauchbar SEMAPHORE_ACCESS_KEY_ENCRYPTION: ${ENCRYPTION_KEY} volumes: - semaphore-data:/var/lib/semaphore depends_on: postgres: condition: service_healthy volumes: postgres-data: semaphore-data: Listing 2: Statisches Inventory im INI-Format [webservers] web-01.example.com ansible_user=deployer web-02.example.com ansible_user=deployer [dbservers] db-01.example.com ansible_user=deployer [prod:children] webservers dbservers [all:vars] ansible_python_interpreter=/usr/bin/python3 Listing 3: Task per Webhook starten curl -X POST \ "https://semaphore.example.com/api/v1/ project/1/tasks?token=WEBHOOK-TOKEN" \ -H "Content-Type: application/json" \ -d "{"template_id": 5}" # Task per Bearer-Token starten und Status pollen curl -X POST https://semaphore.example.com/api/ v1/project/1/tasks \ -H "Authorization: Bearer ${SEMAPHORE_TOKEN}" \ -H "Content-Type: application/json" \ -d "{"template_id": 5, "environment": "{\"deploy_version\": \"2.5.0\"}"}" # Antwort: {"id": 42, "status": "waiting", ...} # Status prüfen curl -H "Authorization: Bearer ${SEMAPHORE_TOKEN}" \ "https://semaphore.example.com/api/v1/ project/1/tasks/42" Listing 4: Cloud-Credentials übergeben "env": { "AWS_ACCESS_KEY_ID": "{{ semaphore_secret.aws_access_key }}", "AWS_SECRET_ACCESS_KEY": "{{ semaphore_secret.aws_secret_key }}", "AWS_DEFAULT_REGION": "eu-central-1", "TF_LOG": "ERROR" }, "extra_vars": { "environment": "production", "vpc_cidr": "10.0.0.0/16" } }