Skip to content

Commit

Permalink
Merge pull request #21 from Melvin-mlp/feat/roleBasedVariables
Browse files Browse the repository at this point in the history
Changed hook var names to not conflict when used with deploy role
  • Loading branch information
ricardclau authored Oct 30, 2018
2 parents e300455 + bb3b1c2 commit d44eb13
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,10 @@ vars:
ansistrano_allow_anonymous_stats: yes

# Hooks: custom tasks if you need them
ansistrano_before_symlink_tasks_file: "{{ playbook_dir }}/<your-deployment-config>/my-before-symlink-tasks.yml"
ansistrano_after_symlink_tasks_file: "{{ playbook_dir }}/<your-deployment-config>/my-after-symlink-tasks.yml"
ansistrano_before_cleanup_tasks_file: "{{ playbook_dir }}/<your-deployment-config>/my-before-cleanup-tasks.yml"
ansistrano_after_cleanup_tasks_file: "{{ playbook_dir }}/<your-deployment-config>/my-after-cleanup-tasks.yml"
ansistrano_rollback_before_symlink_tasks_file: "{{ playbook_dir }}/<your-deployment-config>/my-rollback-before-symlink-tasks.yml"
ansistrano_rollback_after_symlink_tasks_file: "{{ playbook_dir }}/<your-deployment-config>/my-rollback-after-symlink-tasks.yml"
ansistrano_rollback_before_cleanup_tasks_file: "{{ playbook_dir }}/<your-deployment-config>/my-rollback-before-cleanup-tasks.yml"
ansistrano_rollback_after_cleanup_tasks_file: "{{ playbook_dir }}/<your-deployment-config>/my-rollback-after-cleanup-tasks.yml"
```
`{{ playbook_dir }}` is an Ansible variable that holds the path to the current playbook.
Expand Down Expand Up @@ -209,7 +209,7 @@ For example, in order to restart apache after `Symlink` step, we'll add in the `
* **Q: Where would you add sending email notification after a deployment?**
* **Q: (for PHP and Symfony developers) Where would you clean the cache?**

You can specify a custom tasks file for before and after every step using `ansistrano_before_*_tasks_file` and `ansistrano_after_*_tasks_file` role variables. See "Role Variables" for more information.
You can specify a custom tasks file for before and after every step using `ansistrano_rollback_before_*_tasks_file` and `ansistrano_rollback_after_*_tasks_file` role variables. See "Role Variables" for more information.

Variables in custom tasks
-------------------------
Expand Down
12 changes: 6 additions & 6 deletions tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
---
- include_tasks: "{{ ansistrano_before_setup_tasks_file | default('empty.yml') }}"
- include_tasks: "{{ ansistrano_rollback_before_setup_tasks_file | default('empty.yml') }}"
- include_tasks: setup.yml
- include_tasks: "{{ ansistrano_after_setup_tasks_file | default('empty.yml') }}"
- include_tasks: "{{ ansistrano_rollback_after_setup_tasks_file | default('empty.yml') }}"

- include_tasks: "{{ ansistrano_before_symlink_tasks_file | default('empty.yml') }}"
- include_tasks: "{{ ansistrano_rollback_before_symlink_tasks_file | default('empty.yml') }}"
- include_tasks: symlink.yml
- include_tasks: "{{ ansistrano_after_symlink_tasks_file | default('empty.yml') }}"
- include_tasks: "{{ ansistrano_rollback_after_symlink_tasks_file | default('empty.yml') }}"

- include_tasks: "{{ ansistrano_before_cleanup_tasks_file | default('empty.yml') }}"
- include_tasks: "{{ ansistrano_rollback_before_cleanup_tasks_file | default('empty.yml') }}"
- include_tasks: cleanup.yml
- include_tasks: "{{ ansistrano_after_cleanup_tasks_file | default('empty.yml') }}"
- include_tasks: "{{ ansistrano_rollback_after_cleanup_tasks_file | default('empty.yml') }}"

- include_tasks: anon-stats.yml

0 comments on commit d44eb13

Please sign in to comment.