Skip to content

Instantly share code, notes, and snippets.

@exileed
Created April 3, 2018 14:02
Show Gist options
  • Save exileed/c0c9f9e953d99a81bc69f0e7d78ba1ca to your computer and use it in GitHub Desktop.
Save exileed/c0c9f9e953d99a81bc69f0e7d78ba1ca to your computer and use it in GitHub Desktop.
Ansible - Laravel 5.4+ deploy script
- hosts: all
vars:
branch: "master"
app_root: /www
app_repo: "[email protected]"
tasks:
- name: Enable maintenance mode
shell: php artisan down
args:
chdir: "{{ app_root }}"
- name: Drop cached config and packages
shell: "{{ item }}"
args:
chdir: "{{ app_root }}"
with_items:
- "php artisan clear-compiled"
- "php artisan config:clear"
- "php artisan view:clear"
- name: Clone Repository
git:
repo: "{{ app_repo }}"
dest: "{{ app_root }}"
version: "{{ branch }}"
accept_hostkey: true
- name: Composer Install
composer: working_dir={{ app_root }}
- name: Migrate
shell: php artisan migrate --force
args:
chdir: "{{ app_root }}"
- name: Cache app config
shell: php artisan config:cache
args:
chdir: "{{ app_root }}"
- name: Disable maintenance mode
shell: php artisan up
args:
chdir: "{{ app_root }}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment