Skip to content

Instantly share code, notes, and snippets.

@JesseObrien
Created September 5, 2014 13:24
Show Gist options
  • Save JesseObrien/92e5440517974efdee75 to your computer and use it in GitHub Desktop.
Save JesseObrien/92e5440517974efdee75 to your computer and use it in GitHub Desktop.
Deploy script for ansible
- hosts: web
vars_files:
- vars.yml
tasks:
- name: Clone Repository
git: repo="[email protected]" dest=/home/deploy/site version={{ branch }}
notify:
- restart php-fpm service
- restart nginx service
- name: Composer Install
composer: working_dir={{ app_root }}
- name: Migrate Database
shell: php artisan migrate --seed --env={{ app_env }} chdir={{ app_root }}
- name: NPM Install From package.js
npm: path={{ app_root }}
- name: NPM Install grunt-cli
npm: name=grunt-cli global=yes
sudo: yes
- name: Grunt Production to Compile JS/CSS
shell: grunt production chdir={{app_root}}
- name: Dispatcher cron job
cron: name="application scheduled job runner" state=present job="php {{app_root}}/artisan scheduled:run 1>> /dev/null 2>&1"
- name: Notify Hipchat
hipchat: token=mytoken room=myroom msg="{{lookup('env', 'USER')}} deployed to {{groups['web']}}"
handlers:
- name: restart php-fpm service
sudo: yes
service: name=php5-fpm enabled=yes state=restarted
- name: restart nginx service
sudo: yes
service: name=nginx enabled=yes state=restarted
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment