Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Ansible modules for installing and configuring Dokku

License

NotificationsYou must be signed in to change notification settings

dokku/ansible-dokku

Repository files navigation

Ansible RoleReleaseBuild Status

This Ansible role helps install Dokku on Debian/Ubuntu variants. Apartfrom installing Dokku, it also provides various modules that can beused to interface with dokku from your own Ansible playbooks.

Table Of Contents

Requirements

Minimum Ansible Version: 2.2

Platform Requirements

Supported Platforms

  • Ubuntu: noble
  • Ubuntu: jammy
  • Ubuntu: focal
  • Debian: bookworm
  • Debian: bullseye

Dependencies

  • geerlingguy.docker ansible role
  • nginxinc.nginx ansible role
  • Dokku (for library usage)

Role Variables

dokku_daemon_install

  • default:True
  • type:boolean
  • description: Whether to install the dokku-daemon

dokku_daemon_version

  • default:0.0.2
  • type:string
  • description: The version of dokku-daemon to install

dokku_hostname

  • default:dokku.me
  • type:string
  • description: Hostname, used as vhost domain and for showing app URL after deploy

dokku_key_file

  • 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 ondpkg-reconfigure)

dokku_manage_nginx

  • default:True
  • type:boolean
  • description: Whether we should manage the 00-default nginx site

dokku_packages_state

  • default:present
  • type:string
  • description: State of dokku packages. Accepts 'present' and 'latest'

dokku_plugins

  • default:{}
  • type:list
  • description: A list of plugins to install. The hostmust have network access to the install url, and git access if required. Plugins should be specified in the following format:
-name:postgresurl:https://github.com/dokku/dokku-postgres.git-name:redisurl:https://github.com/dokku/dokku-redis.git

dokku_skip_key_file

  • 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.

dokku_users

  • default:null
  • type:list
  • description: A list of users who should have access to Dokku. This willnot grant them generic SSH access, but rather only access as thedokku user. Users should be specified in the following format:
-name:Jane Doeusername:janessh_key:JANES_PUBLIC_SSH_KEY-name:Camillausername:camillassh_key:CAMILLAS_PUBLIC_SSH_KEY

dokku_version (deprecated)

  • default:''
  • type:string
  • description: The version of dokku to install.Scheduled for deletion after 07/2021. Usedokku_packages_state instead.

dokku_vhost_enable

  • default:true
  • type:string
  • description: Use vhost-based deployments (e.g., .dokku.me)

dokku_web_config

  • default:false
  • type:string
  • description: Use web-based config for hostname and keyfile

herokuish_version (deprecated)

  • default:''
  • type:string
  • description: The version of herokuish to install.Scheduled for deletion after 07/2021. Usedokku_packages_state instead.

plugn_version (deprecated)

  • default:''
  • type:string
  • description: The version of plugn to install.Scheduled for deletion after 07/2021. Usedokku_packages_state instead.

sshcommand_version (deprecated)

  • default:''
  • type:string
  • description: The version of sshcommand to install.Scheduled for deletion after 07/2021. Usedokku_packages_state instead.

Libraries

dokku_acl_app

Manage access control list for a given dokku application

Requirements

  • thedokku-acl plugin

Parameters

ParameterChoices/DefaultsComments
app
required
The name of the app
stateChoices:
  • present (default)
  • absent
Whether the ACLs should be present or absent
users
required
The list of users who can manage the app

Example

-name:let leopold manage hello-worlddokku_acl_app:app:hello-worldusers:      -leopold-name:remove leopold from hello-worlddokku_acl_app:app:hello-worldusers:      -leopoldstate:absent

dokku_acl_service

Manage access control list for a given dokku service

Requirements

  • thedokku-acl plugin

Parameters

ParameterChoices/DefaultsComments
service
required
The name of the service
stateChoices:
  • present (default)
  • absent
Whether the ACLs should be present or absent
type
required
The type of the service
users
required
The list of users who can manage the service

Example

-name:let leopold manage mypostgres postgres servicedokku_acl_service:service:mypostgrestype:postgresusers:      -leopold-name:remove leopold from mypostgres postgres servicedokku_acl_service:service:hello-worldtype:postgresusers:      -leopoldstate:absent

dokku_app

Create or destroy dokku apps

Parameters

ParameterChoices/DefaultsComments
app
required
The name of the app
stateChoices:
  • present (default)
  • absent
The state of the app

Example

-name:Create a dokku appdokku_app:app:hello-world-name:Delete that repodokku_app:app:hello-worldstate:absent

dokku_builder

Manage the builder configuration for a given dokku application

Parameters

ParameterChoices/DefaultsComments
app
required
The name of the app. This is required only if global is set to False.
globalDefault: FalseIf the property being set is global
property
required
The property to be changed (e.g.,build-dir,selected)
valueThe value of the builder property (leave empty to unset)

Example

-name:Overriding the auto-selected builderdokku_builder:app:node-js-appproperty:selectedvalue:dockerfile-name:Setting the builder to the default valuedokku_builder:app:node-js-appproperty:selected-name:Changing the build build directorydokku_builder:app:monorepoproperty:build-dirvalue:backend-name:Overriding the auto-selected builder globallydokku_builder:global:trueproperty:selectedvalue:herokuish

dokku_certs

Manages ssl configuration for an app.

Parameters

ParameterChoices/DefaultsComments
app
required
The name of the app
cert
required
Path to the ssl certificate
key
required
Path to the ssl certificate key
stateChoices:
  • present (default)
  • absent
The state of the ssl configuration

Example

-name:Adds an ssl certificate and key to an appdokku_certs:app:hello-worldkey:/etc/nginx/ssl/hello-world.keycert:/etc/nginx/ssl/hello-world.crt-name:Removes an ssl certificate and key from an appdokku_certs:app:hello-worldstate:absent

dokku_checks

Manage the Zero Downtime checks for a dokku app

Parameters

ParameterChoices/DefaultsComments
app
required
The name of the app
stateChoices:
  • present (default)
  • absent
The state of the checks functionality

Example

-name:Disable the zero downtime deploymentdokku_checks:app:hello-worldstate:absent-name:Re-enable the zero downtime deployment (enabled by default)dokku_checks:app:hello-worldstate:present

dokku_clone

Clone a git repository and deploy app.

Parameters

ParameterChoices/DefaultsComments
app
required
The name of the app
buildDefault: TrueWhether to build the app after cloning.
repository
required
Git repository url
versionGit tree (tag or branch name). If not provided, default branch is used.

Example

-name:clone a git repository and build appdokku_clone:app:example-apprepository:https://github.com/heroku/node-js-getting-startedversion:b10a4d7a20a6bbe49655769c526a2b424e0e5d0b-name:clone specific tag from git repository and build appdokku_clone:app:example-apprepository:https://github.com/heroku/node-js-getting-startedversion:b10a4d7a20a6bbe49655769c526a2b424e0e5d0b-name:sync git repository without building appdokku_clone:app:example-apprepository:https://github.com/heroku/node-js-getting-startedbuild:false

dokku_config

Manage environment variables for a given dokku application

Parameters

ParameterChoices/DefaultsComments
app
required
The name of the app
config
required
Default: {}A map of environment variables where key => value
restartDefault: TrueWhether to restart the application or not. If the task is idempotent then setting restart to true will not perform a restart.

Example

-name:set KEY=VALUEdokku_config:app:hello-worldconfig:KEY:VALUE_1KEY_2:VALUE_2-name:set KEY=VALUE without restartdokku_config:app:hello-worldrestart:falseconfig:KEY:VALUE_1KEY_2:VALUE_2

dokku_docker_options

Manage docker-options for a given dokku application

Parameters

ParameterChoices/DefaultsComments
app
required
The name of the app
option
required
A single docker option
phaseChoices:
  • build
  • deploy
  • run
The phase in which to set the options
stateChoices:
  • present (default)
  • absent
The state of the docker options

Example

-name:docker-options:add hello-world deploydokku_docker_options:app:hello-worldphase:deployoption:"-v /var/run/docker.sock:/var/run/docker.sock"-name:docker-options:remove hello-world deploydokku_docker_options:app:hello-worldphase:deployoption:"-v /var/run/docker.sock:/var/run/docker.sock"state:absent

dokku_domains

Manages domains for a given application

Parameters

ParameterChoices/DefaultsComments
app
required
The name of the app. This is required only if global is set to False.
domains
required
A list of domains
globalDefault: FalseWhether to change the global domains or app-specific domains.
stateChoices:
  • enable
  • disable
  • clear
  • present (default)
  • absent
  • set
The state of the application's domains

Example

# Adds domain, inclusive-name:domains:add hello-world dokku.medokku_domains:app:hello-worlddomains:      -dokku.me# Removes listed domains, but leaves others unchanged-name:domains:remove hello-world dokku.medokku_domains:app:hello-worlddomains:      -dokku.mestate:absent# Clears all domains-name:domains:clear hello-worlddokku_domains:app:hello-worldstate:clear# Enables the VHOST domain-name:domains:enable hello-worlddokku_domains:app:hello-worldstate:enable# Disables the VHOST domain-name:domains:disable hello-worlddokku_domains:app:hello-worldstate:disable# Sets the domain for the app, clearing all others-name:domains:set hello-world dokku.medokku_domains:app:hello-worlddomains:      -dokku.mestate:set

dokku_git_sync

Manages syncing git code from a remote repository for an app

Requirements

  • thedokku-git-sync plugin (commercial)

Parameters

ParameterChoices/DefaultsComments
app
required
The name of the app
remoteThe git remote url to use
stateChoices:
  • present (default)
  • absent
The state of the git-sync integration

Example

-name:git-sync:enable hello-worlddokku_git_sync:app:hello-worldremote:git@github.com:hello-world/hello-world.git-name:git-sync:disable hello-worlddokku_git_sync:app:hello-worldstate:absent

dokku_global_cert

Manages global ssl configuration.

Requirements

  • thedokku-global-cert plugin

Parameters

ParameterChoices/DefaultsComments
cert
required
Path to the ssl certificate
key
required
Path to the ssl certificate key
stateChoices:
  • present (default)
  • absent
The state of the ssl configuration

Example

-name:Adds an ssl certificate and keydokku_global_cert:key:/etc/nginx/ssl/global-hello-world.keycert:/etc/nginx/ssl/global-hello-world.crt-name:Removes an ssl certificate and keydokku_global_cert:state:absent

dokku_http_auth

Manage HTTP Basic Authentication for a dokku app

Requirements

  • thedokku-http-auth plugin

Parameters

ParameterChoices/DefaultsComments
app
required
The name of the app
passwordThe HTTP Auth Password (required for 'present' state)
stateChoices:
  • present (default)
  • absent
The state of the http-auth plugin
usernameThe HTTP Auth Username (required for 'present' state)

Example

-name:Enable the http-auth plugindokku_http_auth:app:hello-worldstate:presentusername:samsepi0lpassword:hunter2-name:Disable the http-auth plugindokku_http_auth:app:hello-worldstate:absent

dokku_image

Pull Docker image and deploy app

Parameters

ParameterChoices/DefaultsComments
app
required
The name of the app
build_dirSpecify custom build directory for a custom build context
image
required
Docker image
user_emailGit user.email for customizing the author's email
user_nameGit user.name for customizing the author's name

Example

-name:Pull and deploy meilisearchdokku_image:app:meilisearchimage:getmeili/meilisearch:v0.24.0rc1-name:Pull and deploy image with custom authordokku_image:app:hello-worlduser_name:Elliot Aldersonuser_email:elliotalderson@protonmail.chimage:hello-world:latest-name:Pull and deploy image with custom build dirdokku_image:app:hello-worldbuild_dir:/path/to/buildimage:hello-world:latest

dokku_letsencrypt

Enable or disable the letsencrypt plugin for a dokku app

Requirements

  • thedokku-letsencrypt plugin

Parameters

ParameterChoices/DefaultsComments
app
required
The name of the app
stateChoices:
  • present (default)
  • absent
The state of the letsencrypt plugin

Example

-name:Enable the letsencrypt plugindokku_letsencrypt:app:hello-world-name:Disable the letsencrypt plugindokku_letsencrypt:app:hello-worldstate:absent

dokku_network

Create or destroy container networks for dokku apps

Parameters

ParameterChoices/DefaultsComments
name
required
The name of the network
stateChoices:
  • present (default)
  • absent
The state of the network

Example

-name:Create a networkdokku_network:name:example-network-name:Delete that networkdokku_network:name:example-networkstate:absent

dokku_network_property

Set or clear a network property for a given dokku application

Parameters

ParameterChoices/DefaultsComments
app
required
The name of the app. This is required only if global is set to False.
globalDefault: FalseWhether to change the global network property
property
required
The network property to be be modified. This can be any property supported by dokku (e.g.,initial-network,attach-post-create,attach-post-deploy,bind-all-interfaces,static-web-listener,tld).
valueThe value of the network property (leave empty to unset)

Example

-name:Associates a network after a container is created but before it is starteddokku_network_property:app:hello-worldproperty:attach-post-createvalue:example-network-name:Associates the network at container creationdokku_network_property:app:hello-worldproperty:initial-networkvalue:example-network-name:Setting a global network propertydokku_network_property:global:trueproperty:attach-post-createvalue:example-network-name:Clearing a network propertydokku_network_property:app:hello-worldproperty:attach-post-create

dokku_ports

Manage ports for a given dokku application

Parameters

ParameterChoices/DefaultsComments
app
required
The name of the app
mappings
required
A list of port mappings
stateChoices:
  • clear
  • present (default)
  • absent
The state of the port mappings

Example

-name:ports:set hello-world http:80:80dokku_ports:app:hello-worldmappings:        -http:80:8080-name:ports:remove hello-world http:80:80dokku_ports:app:hello-worldmappings:        -http:80:8080state:absent-name:ports:clear hello-worlddokku_ports:app:hello-worldstate:clear

dokku_proxy

Enable or disable the proxy for a dokku app

Parameters

ParameterChoices/DefaultsComments
app
required
The name of the app
stateChoices:
  • present (default)
  • absent
The state of the proxy

Example

-name:Enable the default proxydokku_proxy:app:hello-world-name:Disable the default proxydokku_proxy:app:hello-worldstate:absent

dokku_ps_scale

Manage process scaling for a given dokku application

Parameters

ParameterChoices/DefaultsComments
app
required
The name of the app
scale
required
Default: {}A map of scale values where proctype => qty
skip_deployDefault: FalseWhether to skip the corresponding deploy or not. If the task is idempotent then leaving skip_deploy as false will not trigger a deploy.

Example

-name:scale web and worker processesdokku_ps_scale:app:hello-worldscale:web:4worker:4-name:scale web and worker processes without deploydokku_ps_scale:app:hello-worldskip_deploy:truescale:web:4worker:4

dokku_registry

Manage the registry configuration for a given dokku application

Requirements

  • thedokku-registry plugin

Parameters

ParameterChoices/DefaultsComments
app
required
The name of the app
imageAlternative to app name for image repository name
passwordThe registry password (required for 'present' state)
serverThe registry server hostname (required for 'present' state)
stateChoices:
  • present (default)
  • absent
The state of the registry integration
usernameThe registry username (required for 'present' state)

Example

-name:registry:enable hello-worlddokku_registry:app:hello-worldpassword:passwordserver:localhost:8080username:user-name:registry:enable hello-world with argsdokku_registry:app:hello-worldimage:other-imagepassword:passwordserver:localhost:8080username:user-name:registry:disable hello-worlddokku_registry:app:hello-worldstate:absent

dokku_resource_limit

Manage resource limits for a given dokku application

Parameters

ParameterChoices/DefaultsComments
app
required
The name of the app
clear_beforeChoices:
  • True
  • False (default)
Clear all resource limits before applying
process_typeThe process type selector
resourcesThe Resource type and quantity (required when state=present)
stateChoices:
  • present (default)
  • absent
The state of the resource limits

Example

-name:Limit CPU and memory of a dokku appdokku_resource_limit:app:hello-worldresources:cpu:100memory:100-name:name: Limit resources per process type of a dokku appdokku_resource_limit:app:hello-worldprocess_type:webresources:cpu:100memory:100-name:Clear limits before applying new limitsdokku_resource_limit:app:hello-worldstate:presentclear_before:Trueresources:cpu:100memory:100-name:Remove all resource limitsdokku_resource_limit:app:hello-worldstate:absent

dokku_resource_reserve

Manage resource reservations for a given dokku application

Parameters

ParameterChoices/DefaultsComments
app
required
The name of the app
clear_beforeChoices:
  • True
  • False (default)
Clear all reserves before apply
process_typeThe process type selector
resourcesThe Resource type and quantity (required when state=present)
stateChoices:
  • present (default)
  • absent
The state of the resource reservations

Example

-name:Reserve CPU and memory for a dokku appdokku_resource_reserve:app:hello-worldresources:cpu:100memory:100-name:Create a reservation per process type of a dokku appdokku_resource_reserve:app:hello-worldprocess_type:webresources:cpu:100memory:100-name:Clear all reservations before applyingdokku_resource_reserve:app:hello-worldstate:presentclear_before:Trueresources:cpu:100memory:100-name:Remove all resource reservationsdokku_resource_reserve:app:hello-worldstate:absent

dokku_service_create

Creates a given service

Parameters

ParameterChoices/DefaultsComments
name
required
The name of the service
service
required
The type of service to create

Example

-name:redis:create defaultdokku_service_create:name:defaultservice:redis-name:postgres:create defaultdokku_service_create:name:defaultservice:postgres-name:postgres:create default with custom imageenvironment:POSTGRES_IMAGE:postgis/postgisPOSTGRES_IMAGE_VERSION:13-masterdokku_service_create:name:defaultservice:postgres

dokku_service_link

Links and unlinks a given service to an application

Parameters

ParameterChoices/DefaultsComments
app
required
The name of the app
name
required
The name of the service
service
required
The type of service to link
stateChoices:
  • present (default)
  • absent
The state of the service link

Example

-name:redis:link default hello-worlddokku_service_link:app:hello-worldname:defaultservice:redis-name:postgres:link default hello-worlddokku_service_link:app:hello-worldname:defaultservice:postgres-name:redis:unlink default hello-worlddokku_service_link:app:hello-worldname:defaultservice:redisstate:absent

dokku_storage

Manage storage for dokku applications

Parameters

ParameterChoices/DefaultsComments
appThe name of the app
create_host_dirDefault: FalseWhether to create the host directory or not
groupDefault: 32767A group or gid that should own the created folder
mountsDefault: []A list of mounts to create, colon (:) delimited, in the format:host_dir:container_dir
stateChoices:
  • present (default)
  • absent
The state of the service link
userDefault: 32767A user or uid that should own the created folder

Example

-name:mount a pathdokku_storage:app:hello-worldmounts:      -/var/lib/dokku/data/storage/hello-world:/data-name:mount a path and create the host_dir directorydokku_storage:app:hello-worldmounts:      -/var/lib/dokku/data/storage/hello-world:/datacreate_host_dir:true-name:unmount a pathdokku_storage:app:hello-worldmounts:      -/var/lib/dokku/data/storage/hello-world:/datastate:absent-name:unmount a path and destroy the host_dir directory (and contents)dokku_storage:app:hello-worldmounts:      -/var/lib/dokku/data/storage/hello-world:/datadestroy_host_dir:truestate:absent

Example Playbooks

Installing Dokku

----hosts:allroles:    -dokku_bot.ansible_dokku

Installing Plugins

----hosts:allroles:    -dokku_bot.ansible_dokkuvars:dokku_plugins:      -name:cloneurl:https://github.com/crisward/dokku-clone.git      -name:postgresurl:https://github.com/dokku/dokku-postgres.git

Deploying a simple word inflector

----hosts:allroles:    -dokku_bot.ansible_dokkutasks:    -name:dokku apps:create inflectordokku_app:app:inflector    -name:dokku clone inflectordokku_clone:app:inflectorrepository:https://github.com/cakephp/inflector.cakephp.org

Setting up a Small VPS with a Dokku App

----hosts:allroles:    -dokku_bot.ansible_dokku    -geerlingguy.swapvars:# If you are running dokku on a small VPS, you'll most likely# need some swap to ensure you don't run out of RAM during deploysswap_file_size_mb:'2048'dokku_version:0.19.13dokku_users:      -name:yournameusername:yournamessh_key:"{{lookup('file', '~/.ssh/id_rsa.pub')}}"dokku_plugins:      -name:cloneurl:https://github.com/crisward/dokku-clone.git      -name:letsencrypturl:https://github.com/dokku/dokku-letsencrypt.gittasks:    -name:create appdokku_app:# change this name in your template!app:&appname appname    -name:environment configurationdokku_config:app:*appnameconfig:# specify port so `domains` can setup the port mapping properlyPORT:"5000"    -name:git clone# note you'll need to add a deployment key to the GH repo if it's private!dokku_clone:app:*appnamerepository:git@github.com:heroku/python-getting-started.git    -name:add domaindokku_domains:app:*appnamedomains:          -example.com    -name:add letsencryptdokku_letsencrypt:app:*appname

Contributing

SeeCONTRIBUTING.md.

License

MIT License

See LICENSE.md for further details.


[8]ページ先頭

©2009-2025 Movatter.jp