π οΈ Semaphore UI Setup β Role Overview
The semaphoreui_setup role installs and configures Semaphore UI with optional Entra ID OIDC integration.
Primary role metadata:
Main responsibilities:
- Install Semaphore UI binaries and prerequisites
- Render Semaphore runtime config
- Create and persist admin credentials
- Start and enable Semaphore service
- Configure Semaphore objects over API (projects, repos, templates, schedules, etc.)
π» Supported Hosts
Primary host group: semaphore
Deployment mode:
- become: true
- gather_facts: true
Main deploy playbook:
Deployment role chain:
- global
- sshpass
- autofs
- azure_cli_setup
- entra_id_oauth2
- semaphoreui_setup
π Entra ID / OIDC Integration
Entra app registration and secret generation run before semaphoreui_setup.
Entra registration logic:
Registration process:
- Resolve redirect URI from site config by priority:
- app_redirect_url
- oauth2_callback_url (legacy)
- Create app if missing
- Update redirect URIs for existing apps
- Rotate app secret
- Inject oauth2_client_id and oauth2_client_secret into rproxy_setup_sites
π Inventory Structure (Semaphore)
Semaphore inventory config:
Site block contains:
- rproxy_setup_sites entry for semaphore.refol.us
- app_redirect_url for Semaphore OIDC callback
- oauth2_callback_url (optional, legacy fallback)
βοΈ Role Execution Structure
Role entrypoint:
Execution flow:
- install.yml
- configure.yml
- runner.yml (when remote runner enabled)
Config rendering:
OIDC values sourced from:
- roles/semaphoreui_setup/defaults/main/main.yml
- semaphoreui_setup_oidc_redirect_url derives from semaphoreui_setup_oidc_site.app_redirect_url
π Setup API Mode (Project/Template/Schedule Management)
API setup entrypoint:
Handles:
- API token creation
- User enumeration
- Dynamic inventory discovery
- Project consolidation
- Setup of views, keystores, repositories, inventories, templates, schedules
Setup tasks:
π Auth/Data Flow
- Inventory provides semaphore site entry with app_redirect_url
- entra_id_oauth2 registers or updates Entra app redirect URI
- entra_id_oauth2 rotates secret and injects oauth2_client_id/oauth2_client_secret into rproxy_setup_sites
- semaphoreui_setup reads injected values and renders config.json OIDC provider settings
- Semaphore sign-in uses configured redirect URI
β Operator Notes
- Native Semaphore OIDC redirect URI: https://semaphore.refol.us/api/auth/oidc/azure/redirect
- app_redirect_url takes priority in redirect URI resolution
- oauth2_callback_url available for legacy compatibility
- Redirect URIs are synchronized with Entra app registration for existing apps