Version: 2019.04.3
This Ansible role helps install Dokku on Debian/Ubuntu variants. Apart from installing Dokku, it also provides various modules that can be used to interface with dokku from your own Ansible playbooks.
Minimum Ansible Version: 2.2
Supported Platforms
- Ubuntu: trusty
- Ubuntu: utopic
- Ubuntu: vivid
- Ubuntu: wily
- Ubuntu: xenial
- Ubuntu: yakkety
- Ubuntu: zesty
- Ubuntu: artful
- Ubuntu: bionic
- Debian: wheezy
- Debian: jessie
- Debian: stretch
- Debian: buster
- Dokku version 0.16.1 (for library usage)
- default:
58118E89F3A912897C070ADBF76221572C52609D
- type:
string
- description: apt.docker repository key signature
- default:
hkp://p80.pool.sks-keyservers.net:80
- type:
string
- description: Location to retrieve the apt.docker key
- default:
9DC858229FC7DD38854AE2D88D81803C0EBFCD88
- type:
string
- description: download.docker repository key signature
- default:
https://download.docker.com/linux/ubuntu/gpg
- type:
string
- description: Location for download.docker key
- default:
True
- type:
boolean
- description: Whether to install the dokku-daemon
- default:
f3b7b0ab1b6368d49e569de03af28e497ce0a0c9
- type:
string
- description: Version of dokku-daemon to install
- default:
dokku.me
- type:
string
- description: Hostname, used as vhost domain and for showing app URL after deploy
- default:
/root/.ssh/id_rsa.pub
- type:
string
- description: Path on disk to an SSH key to add to the Dokku user (Will be ignored on
dpkg-reconfigure
)
- default:
True
- type:
boolean
- description: Whether we should manage the 00-default nginx site
- default:
{}
- type:
list
- description: A list of plugins to install. The host must have network access to the install url, and git access if required. Plugins should be specified in the following format:
- name: postgres
url: https://github.com/dokku/dokku-postgres.git
- name: redis
url: https://github.com/dokku/dokku-redis.git
- default:
false
- type:
string
- description: Do not check for the existence of the dokku/key_file. Setting this to "true", will require you to manually add an SSH key later on.
- default:
None
- type:
list
- description: A list of users who should have access to Dokku. This will not grant them generic SSH access, but rather only access as the
dokku
user. Users should be specified in the following format:
- name: Jane Doe
username: jane
ssh_key: JANES_PUBLIC_SSH_KEY
- name: Camilla
username: camilla
ssh_key: CAMILLAS_PUBLIC_SSH_KEY
- default:
0.16.1
- type:
version
- description: The version of Dokku to install
- default:
true
- type:
string
- description: Use vhost-based deployments (e.g., .dokku.me)
- default:
false
- type:
string
- description: Use web-based config for hostname and keyfile
- default:
0.5.0
- type:
version
- description: The version of herokuish to install
- default:
0.3.0
- type:
version
- description: The version of plugn to install
- default:
0.7.0
- type:
version
- description: The version of sshcommand to install
Create or destroy dokku apps
Parameter | Choices/Defaults | Comments |
---|---|---|
app required |
The name of the app | |
state | Choices:
|
The state of the app |
- name: Create a dokku app
dokku_app:
app: hello-world
- name: Delete that repo
dokku_app:
app: hello-world
state: absent
Manages ssl configuration for an app.
Parameter | Choices/Defaults | Comments |
---|---|---|
app required |
The name of the app | |
cert required |
Path to the ssl certificate | |
key required |
Path to the ssl certificate key | |
state | Choices:
|
The state of the ssl configuration |
- name: Adds an ssl certificate and key to an app
dokku_certs:
app: hello-world
key: /etc/nginx/ssl/hello-world.key
cert: /etc/nginx/ssl/hello-world.crt
- name: Removes an ssl certificate and key from an app
dokku_certs:
app: hello-world
state: absent
Deploys a repository to an undeployed application
- the
dokku-clone
plugin
Parameter | Choices/Defaults | Comments |
---|---|---|
app required |
The name of the app | |
repository required |
Git repository url |
- name: clone a repo
dokku_clone:
app: hello-world
repository: https://github.com/hello-world/hello-world.git
Manage environment variables for a given dokku application
Parameter | Choices/Defaults | Comments |
---|---|---|
app required |
The name of the app | |
config required |
Default: {} | A map of environment variables where key => value |
- name: set KEY=VALUE
dokku_config:
app: hello-world
config:
KEY: VALUE_1
KEY_2: VALUE_2
Manage the consul configuration for a given dokku application
- the
dokku-consul
plugin (commercial)
Parameter | Choices/Defaults | Comments |
---|---|---|
app required |
The name of the app | |
endpoint | Default: / | The consul healthcheck endpoint |
interval | Default: 60s | The consul healthcheck interval |
state | Choices:
|
The state of the consul integration |
timeout required |
Default: 60s | The consul healthcheck timeout |
- name: consul:enable hello-world
dokku_consul:
app: hello-world
- name: consul:enable hello-world with args
dokku_consul:
app: hello-world
endpoint: /_status
- name: consul:disable hello-world
dokku_consul:
app: hello-world
state: absent
Manage docker-options for a given dokku application
Parameter | Choices/Defaults | Comments |
---|---|---|
app required |
The name of the app | |
option required |
A single docker option | |
phase | Choices:
|
The phase in which to set the options |
state | Choices:
|
The state of the docker options |
- name: docker-options:add hello-world deploy
dokku_docker_options:
app: hello-world
phase: deploy
options:
- "-v /var/run/docker.sock:/var/run/docker.sock"
- name: docker-options:remove hello-world deploy
dokku_docker_options:
app: hello-world
phase: deploy
options:
- "-v /var/run/docker.sock:/var/run/docker.sock"
state: absent
Manages domains for a given application
Parameter | Choices/Defaults | Comments |
---|---|---|
app required |
The name of the app | |
domains required |
A list of domains | |
state | Choices:
|
The state of the application's domains |
- name: domains:add hello-world dokku.me
dokku_domains:
app: hello-world
domains:
- dokku.me
- name: domains:remove hello-world dokku.me
dokku_domains:
app: hello-world
domains:
- dokku.me
state: absent
- name: domains:clear hello-world
dokku_domains:
app: hello-world
state: clear
- name: domains:enable hello-world
dokku_domains:
app: hello-world
state: enable
- name: domains:disable hello-world
dokku_domains:
app: hello-world
state: disable
Manage the ecr configuration for a given dokku application
- the
dokku-ecr
plugin (commercial)
Parameter | Choices/Defaults | Comments |
---|---|---|
account-id | The ecr aws account-id | |
app required |
The name of the app | |
image-repo | The image name to use when pushing to ecr | |
region | Default: us-east-1 | The ecr region |
state | Choices:
|
The state of the ecr integration |
- name: ecr:enable hello-world
dokku_ecr:
app: hello-world
- name: ecr:enable hello-world with args
dokku_ecr:
app: hello-world
image-repo: prod-hello-world
- name: ecr:disable hello-world
dokku_ecr:
app: hello-world
state: absent
Manages syncing git code from a remote repository for an app
- the
dokku-git-sync
plugin (commercial)
Parameter | Choices/Defaults | Comments |
---|---|---|
app required |
The name of the app | |
remote | The git remote url to use | |
state | Choices:
|
The state of the git-sync integration |
- name: git-sync:enable hello-world
dokku_git_sync:
app: hello-world
remote: [email protected]:hello-world/hello-world.git
- name: git-sync:disable hello-world
dokku_git_sync:
app: hello-world
state: absent
Manages global ssl configuration.
- the
dokku-global-cert
plugin
Parameter | Choices/Defaults | Comments |
---|---|---|
cert required |
Path to the ssl certificate | |
key required |
Path to the ssl certificate key | |
state | Choices:
|
The state of the ssl configuration |
- name: Adds an ssl certificate and key
dokku_global_cert:
key: /etc/nginx/ssl/global-hello-world.key
cert: /etc/nginx/ssl/global-hello-world.crt
- name: Removes an ssl certificate and key
dokku_global_cert:
state: absent
Manage ports for a given dokku application
Parameter | Choices/Defaults | Comments |
---|---|---|
app required |
The name of the app | |
mappings required |
A list of port mappings | |
state | Choices:
|
The state of the port mappings |
- name: proxy:ports-add hello-world http:80:80
dokku_service_link:
app: hello-world
mappings:
- http:80:8080
- name: proxy:ports-remove hello-world http:80:80
dokku_service_link:
app: hello-world
mappings:
- http:80:8080
state: absent
- name: proxy:ports-clear hello-world
dokku_service_link:
app: hello-world
state: clear
Enable or disable the proxy for a dokku app
Parameter | Choices/Defaults | Comments |
---|---|---|
app required |
The name of the app | |
state | Choices:
|
The state of the proxy |
- name: Enable the default proxy
dokku_proxy:
app: hello-world
- name: Disable the default proxy
dokku_proxy:
app: hello-world
state: absent
Manage the registry configuration for a given dokku application
- the
dokku-registry
plugin (commercial)
Parameter | Choices/Defaults | Comments |
---|---|---|
app required |
The name of the app | |
image | Alternative to app name for image repository name | |
password | The registry password (required for 'present' state) | |
server | The registry server hostname (required for 'present' state) | |
state | Choices:
|
The state of the registry integration |
username | The registry username (required for 'present' state) |
- name: registry:enable hello-world
dokku_registry:
app: hello-world
password: password
server: localhost:8080
username: user
- name: registry:enable hello-world with args
dokku_registry:
app: hello-world
image: other-image
password: password
server: localhost:8080
username: user
- name: registry:disable hello-world
dokku_registry:
app: hello-world
state: absent
Creates a given service
Parameter | Choices/Defaults | Comments |
---|---|---|
name required |
The name of the service | |
service required |
The type of service to create |
- name: redis:create default
dokku_service_create:
name: default
service: redis
Links and unlinks a given service to an application
Parameter | Choices/Defaults | Comments |
---|---|---|
app required |
The name of the app | |
name required |
The name of the service | |
service required |
The type of service to link | |
state | Choices:
|
The state of the service link |
- name: redis:link default hello-world
dokku_service_link:
app: hello-world
name: default
service: redis
- name: redis:unlink default hello-world
dokku_service_link:
app: hello-world
name: default
service: redis
state: absent
Manage storage for dokku applications
Parameter | Choices/Defaults | Comments |
---|---|---|
app | The name of the app | |
create_host_dir | Default: False | Whether to create the host directory or not |
group | Default: 32767 | A group or gid that should own the created folder |
mounts | Default: [] | A list of mounts to create, colon (:) delimited, in the format: host_dir:container_dir |
state | Choices:
|
The state of the service link |
user | Default: 32767 | A user or uid that should own the created folder |
- name: mount a path
dokku_storage:
app: hello-world
mounts:
- /var/lib/dokku/data/storage/hello-world:/data
- name: mount a path and create the host_dir directory
dokku_storage:
app: hello-world
mounts:
- /var/lib/dokku/data/storage/hello-world:/data
create_host_dir: true
- name: unmount a path
dokku_storage:
app: hello-world
mounts:
- /var/lib/dokku/data/storage/hello-world:/data
state: absent
- name: unmount a path and destroy the host_dir directory (and contents)
dokku_storage:
app: hello-world
mounts:
- /var/lib/dokku/data/storage/hello-world:/data
destroy_host_dir: true
state: absent
---
- hosts: all
roles:
- dokku
---
- hosts: all
roles:
- dokku
vars:
dokku_plugins:
- name: clone
url: https://github.com/crisward/dokku-clone.git
- name: postgres
url: https://github.com/dokku/dokku-postgres.git
---
- hosts: all
tasks:
- name: dokku apps:create inflector
dokku_app:
app: inflector
- name: dokku clone inflector
dokku_clone:
app: inflector
repository: https://github.com/cakephp/inflector.cakephp.org
MIT License
See LICENSE.md for further details.