Skip to content

Instantly share code, notes, and snippets.

@sameg14
Created April 29, 2016 19:58
Show Gist options
  • Save sameg14/64fbb7a376868d6bae729869b154a53c to your computer and use it in GitHub Desktop.
Save sameg14/64fbb7a376868d6bae729869b154a53c to your computer and use it in GitHub Desktop.
Ansible playbook to deploy
---
- name: Update code
sudo: yes
sudo_user: ubuntu
git: repo=ssh://git@github.com/sameg14/tib.git
dest=/var/www/tib
version=master
accept_hostkey=True
force=True
- name: Update production config
copy: src="../app/.prod_htaccess" dest="/var/www/tib/web/.htaccess"
when: symfony_env == "prod"
- name: Set dev config
copy: src="../app/.dev_htaccess" dest="/var/www/tib/web/.htaccess"
when: symfony_env == "dev"
- name: Install composer packages
composer: command=install working_dir=/var/www/tib
- name: Optimize composer
remote_user: ubuntu
shell: composer dump-autoload --optimize
args:
chdir: /var/www/tib
- name: Migrate database
shell: ./bin/phinx migrate -e {{ symfony_env }}
args:
chdir: /var/www/tib
- name: Clear cache
shell: ./app/console cache:clear -e {{ symfony_env }}
sudo: yes
sudo_user: ubuntu
args:
chdir: /var/www/tib
- name: Restart web server
service: name=apache2 state=restarted
sudo: yes
sudo_user: ubuntu
- shell: sudo service apache2 restart
sudo: True
ignore_errors: yes
- name: Restart jobs
shell: sudo supervisorctl restart all
sudo: yes
sudo_user: ubuntu
ignore_errors: yes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment