diff --git a/README.md b/README.md index 8773872..af47bc1 100644 --- a/README.md +++ b/README.md @@ -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 }}//my-before-setup-tasks.yml" - ansistrano_after_setup_tasks_file: "{{ playbook_dir }}//my-after-setup-tasks.yml" - ansistrano_before_update_code_tasks_file: "{{ playbook_dir }}//my-before-update-code-tasks.yml" - ansistrano_after_update_code_tasks_file: "{{ playbook_dir }}//my-after-update-code-tasks.yml" ansistrano_before_symlink_tasks_file: "{{ playbook_dir }}//my-before-symlink-tasks.yml" ansistrano_after_symlink_tasks_file: "{{ playbook_dir }}//my-after-symlink-tasks.yml" ansistrano_before_cleanup_tasks_file: "{{ playbook_dir }}//my-before-cleanup-tasks.yml" @@ -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: diff --git a/defaults/main.yml b/defaults/main.yml index b624e21..76c8335 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -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 \ No newline at end of file diff --git a/meta/main.yml b/meta/main.yml index 9977050..3613ad3 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -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 diff --git a/tasks/cleanup.yml b/tasks/cleanup.yml index fce81db..85ceccd 100644 --- a/tasks/cleanup.yml +++ b/tasks/cleanup.yml @@ -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 diff --git a/tasks/symlink.yml b/tasks/symlink.yml index 2bbfa00..997d526 100644 --- a/tasks/symlink.yml +++ b/tasks/symlink.yml @@ -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