Ansible Deployment
This section documents the Ansible layout for self-hosted Releasy.
Layout
Expected structure for the Ansible repo subtree:
infra/
playbooks/
site.yml
roles/
releasy_postgres/
releasy_server/
traefik/
keycloak/ # optional
tailscale/ # optional
inventory/
hosts.yml
group_vars/
all/
all.yml
vault.yml
releasy_app.yml
releasy_db.yml
traefik.yml
keycloak.ymlPlaybook Structure
playbooks/site.yml should provision components in this order:
- Database hosts (
releasy_db) ->releasy_postgres. - App hosts (
releasy_app) ->releasy_server(run withserial: 1). - Optional IdP hosts (
keycloak) ->keycloak. - Proxy hosts (
traefik) ->traefik.
Use serial: 1 for app/IdP groups to enable rolling updates. If a private network is required, include the tailscale role per host.
Roles
releasy_postgres: installs Postgres, creates the app database/user, configures listen addresses, and applies DB firewall rules.releasy_server: installs Docker, renders env files, installs a systemd template unit, and performs rolling restarts.traefik: terminates TLS and routes/to the Releasy instances.keycloak(optional): deploys IdP for operator auth.tailscale(optional): private networking between hosts.
Variables and Secrets
Keep non-secret defaults in group_vars and keep secrets in Vault.
Recommended files:
inventory/group_vars/all/all.yml: shared defaults (ports, image, instance list, registry host).inventory/group_vars/releasy_app.yml: app settings, ports, firewall controls, health endpoint, proxy upstreams.inventory/group_vars/releasy_db.yml: Postgres settings and allowed CIDRs.inventory/group_vars/traefik.yml: domains, TLS settings, upstreams.inventory/group_vars/keycloak.yml: optional IdP settings.
Secrets live in inventory/group_vars/all/vault.yml and must be encrypted with ansible-vault. Suggested secret keys:
releasy_admin_api_keyreleasy_api_key_pepperreleasy_registry_usernamereleasy_registry_passwordreleasy_database_url(if not derived from Postgres vars)releasy_artifact_access_key/releasy_artifact_secret_keykeycloak_admin_user/keycloak_admin_password(if enabled)
Quickstart
- Define your inventory in
infra/inventory/hosts.yml. - Fill
group_varswith non-secret defaults. - Create
inventory/group_vars/all/vault.ymland encrypt it. - Run the playbook.
Example inventory (single-host):
all:
vars:
ansible_user: root
children:
releasy_app:
hosts:
releasy:
ansible_host: 10.0.1.10
releasy_db:
hosts:
releasy:
ansible_host: 10.0.2.10
traefik:
hosts:
releasy:
ansible_host: 10.0.3.10Run:
cd infra
ansible-vault encrypt inventory/group_vars/all/vault.yml \
--vault-password-file ~/.secure/releasy-vault-pass
ansible-playbook playbooks/site.yml \
--vault-password-file ~/.secure/releasy-vault-passRunbook
Dry run:
bashansible-playbook playbooks/site.yml --check --diff \ --vault-password-file ~/.secure/releasy-vault-passDeploy one component:
bashansible-playbook playbooks/site.yml --limit releasy_app \ --vault-password-file ~/.secure/releasy-vault-passRolling update (multi-host): keep
serial: 1and update hosts one by one. For blue/green, updatereleasy_server_instancesand adjust the proxy upstream list.Rollback: pin
releasy_server_imageto the previous tag and rerun the playbook.