No description
- Jinja 100%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| .gitea/workflows | ||
| defaults | ||
| meta | ||
| tasks | ||
| templates | ||
| .gitignore | ||
| CHANGELOG.md | ||
| LICENSE | ||
| README.md | ||
docker-app
Deploys a generic Docker service via Docker Compose, routed through Traefik as a reverse proxy.
Requirements
- Docker
community.dockerAnsible collection
Variables
| Variable | Default | Description |
|---|---|---|
docker_app_instance |
docker_app |
Unique instance name. Used as Compose project name and Traefik router prefix. Change when running multiple instances on the same host. |
docker_app_image |
~ |
Container image without tag (e.g. nginx). Required. |
docker_app_version |
latest |
Image tag. Pin to a specific version in production. |
docker_app_name |
docker_app |
Container and service name inside the compose file. |
docker_app_docker_path |
/docker/app |
Host path for the compose.yml file. |
docker_app_domain |
~ |
Public domain the app runs on (no protocol prefix). Required. Enables Traefik routing and attaches to the traefik_web network. |
docker_app_uninstall |
false |
Stops and removes containers and the compose directory. |
Usage
Minimal setup:
docker_app_image: "nginx"
docker_app_domain: "app.example.com"
Pinned version with a custom instance name:
docker_app_instance: myapp
docker_app_image: myrepo/myapp
docker_app_version: "1.4.2"
docker_app_name: myapp
docker_app_domain: myapp.example.com
docker_app_docker_path: /docker/myapp
Multiple instances on the same host:
# instance 1
docker_app_instance: app_a
docker_app_image: nginx
docker_app_domain: a.example.com
docker_app_docker_path: /docker/app_a
# instance 2
docker_app_instance: app_b
docker_app_image: caddy
docker_app_domain: b.example.com
docker_app_docker_path: /docker/app_b
Uninstall
To stop and remove all containers and the compose directory:
docker_app_uninstall: true
Notes
- The container is always attached to the
traefik_webexternal network. Traefik must be running and that network must exist before deploying. - TLS is handled by Traefik using the
defaultcert resolver. - The compose file is written as
root:rootwith mode0600.