Improved README and more explicity ansible commands

This commit is contained in:
Luke Murphy 2020-03-19 23:54:34 +01:00
parent 76489c3fea
commit 394fc3ed9e
No known key found for this signature in database
GPG Key ID: 5E2EF5A63E3718CC
2 changed files with 12 additions and 8 deletions

View File

@ -2,15 +2,18 @@
Run ansible playbooks during deployment.
This plugin can be useful when you need to provision your server before or after a deployment of your application (or on [any hook](https://github.com/dokku/dokku/blob/master/docs/development/plugin-triggers.md), just raise an issue and let's add it) and you prefer to use Ansible instead of Bash. For example, you make use of the [ansible-dokku](https://github.com/dokku/ansible-dokku/) roles.
## Requirements
* dokku 0.19.13+
* Debian based system (uses `apt` package manager for dependencies)
* Debian based system (uses `apt` package manager for installing dependencies)
## Installation
```shell
$ dokku plugin:install https://github.com/decentral1se/dokku-ansible-playbook.git
$ dokku plugin:install-dependencies
```
## Usage
@ -18,13 +21,14 @@ $ dokku plugin:install https://github.com/decentral1se/dokku-ansible-playbook.gi
All files must be placed within the `ansible` folder of your git repository.
* `requirements.yml`: what role dependencies to download before running your plays.
* `pre-deploy.yml`: play run before a deployment
* `post-deploy.yml`: play run after a deployment
The following hooks are supported (add `.yml` to the hook name in `ansible`):
Notes:
* `pre-deploy`
* `post-deploy`
Everything is copied into `$DOKKU_LIB_ROOT/data/ansible/$APP` on the `post-extract` hook.
* Everything is copied into `$DOKKU_LIB_ROOT/data/ansible/$APP` on the `post-extract` hook.
* Dokku will make sure that your Ansible plays are run on the right hook against the Dokku server localhost.
* The `ansible-galaxy` install command is run with `--force` to ensure a clean slate on each hook execution.
## Example

View File

@ -15,9 +15,9 @@ function run_playbook() {
if [[ -f "$requirements" ]]; then
dokku_col_log_info1_quiet "$requirements file found"
ansible-galaxy install -fr "$requirements"
ansible-galaxy install -vvv --force --role-file "$requirements"
fi
dokku_col_log_info1_quiet "$play_path file found"
ansible-playbook -i 127.0.0.1, -c local "$play_path"
ansible-playbook --inventory "$(hostname)", --connection local "$play_path"
}