Skip to content

Commit

Permalink
Merge pull request #5 from ansistrano/optional_rollback_nodelete
Browse files Browse the repository at this point in the history
Added optional deletion for rolled back release.
  • Loading branch information
ricardclau committed Oct 29, 2015
2 parents bb0a2b2 + ecd910e commit 3ed410d
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 15 deletions.
13 changes: 2 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,21 +82,12 @@ Role Variables

```yaml
- vars:
ansistrano_deploy_from: "./" # Where my local project is
ansistrano_deploy_to: "/var/www/my-app" # Base path to deploy to.
ansistrano_version_dir: "releases" # Releases folder name
ansistrano_current_dir: "current" # Softlink name. You should rarely changed it.
ansistrano_keep_releases: 0 # Releases to keep after a new deployment. See "Pruning old releases".
ansistrano_deploy_via: "rsync" # Method used to deliver the code to the server. Options are copy, rsync or git
ansistrano_rsync_extra_params: "" # Extra parameters to use when deploying with rsync
ansistrano_git_repo: git@github.com:USERNAME/REPO.git # Location of the git repository
ansistrano_git_branch: master # Branch to use when deploying
ansistrano_remove_rolled_back: yes # You can change this setting in order to keep the rolled back release in the server for later inspection

# Hooks: custom tasks if you need them
ansistrano_before_setup_tasks_file: "{{ playbook_dir }}/<your-deployment-config>/my-before-setup-tasks.yml"
ansistrano_after_setup_tasks_file: "{{ playbook_dir }}/<your-deployment-config>/my-after-setup-tasks.yml"
ansistrano_before_update_code_tasks_file: "{{ playbook_dir }}/<your-deployment-config>/my-before-update-code-tasks.yml"
ansistrano_after_update_code_tasks_file: "{{ playbook_dir }}/<your-deployment-config>/my-after-update-code-tasks.yml"
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"
Expand Down Expand Up @@ -154,7 +145,7 @@ In order to rollback with Ansistrano, you need to set up the deployment and run
```ansible-playbook -i hosts rollback.yml```

If you try to rollback with zero or one releases deployed, an error will be raised and no actions performed.
If you try to roll back with zero or one releases deployed, an error will be raised and no actions performed.

Variables you can tune in rollback role are less than in deploy one:

Expand Down
3 changes: 2 additions & 1 deletion defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ ansistrano_version_dir: "releases"
# Softlink name for the current release
ansistrano_current_dir: "current"

max_fail_percentage: 0
# Remove rolled back release?
ansistrano_remove_rolled_back: yes
2 changes: 1 addition & 1 deletion meta/main.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
galaxy_info:
author: ansistrano
description: Ansible role to rollback scripting applications like PHP, Python, Ruby, etc. in a Capistrano style
description: Ansible role to roll back scripting applications like PHP, Python, Ruby, etc. in a Capistrano style
company: Ansistrano
license: MIT
min_ansible_version: 1.6
Expand Down
3 changes: 2 additions & 1 deletion tasks/cleanup.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
- name: ANSISTRANO | Remove rollbacked version
- name: ANSISTRANO | Remove rolled back version
file: state=absent path={{ ansistrano_releases_path.stdout }}/{{ ansistrano_current_release_version.stdout }}
when: ansistrano_remove_rolled_back
2 changes: 1 addition & 1 deletion tasks/symlink.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
register: ansistrano_versions_count

- name: ANSISTRANO | Check if there is more than one release
fail: msg="Could not rollback the code because there is no prior release"
fail: msg="Could not roll back the code because there is no prior release"
when: ansistrano_versions_count.stdout|int <= 1

- name: ANSISTRANO | Get current release version
Expand Down

0 comments on commit 3ed410d

Please sign in to comment.