Skip to content

Instantly share code, notes, and snippets.

@mlvnds
Created July 27, 2018 10:17
Show Gist options
  • Save mlvnds/97f941c8dbfebc4c937502c8bdfba837 to your computer and use it in GitHub Desktop.
Save mlvnds/97f941c8dbfebc4c937502c8bdfba837 to your computer and use it in GitHub Desktop.
Template ansistrano pour le playbook
---
- hosts: all
any_errors_fatal: true
vars_files:
- vars.yml
tasks:
- block:
- include_role:
name: "cbrunnkvist.ansistrano-symfony-deploy"
rescue:
- name: ROLLBACK | Fetch stat of current symlink
stat:
path: "{{ ansistrano_deploy_to }}/{{ ansistrano_current_dir }}"
register: stat_current_link
- name: ROLLBACK | Remove not fully deployed release
file:
state: absent
path: "{{ ansistrano_release_path.stdout }}"
when: >
(stat_current_link.stat.islnk is not defined)
or
(ansistrano_release_path.stdout != stat_current_link.stat.lnk_source)
- name: ROLLBACK | Force Ansible to return an exit code error
fail:
msg: "Something gone wrong during deployment, refer to logs."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment