Created
June 3, 2015 06:29
-
-
Save JulienSansot/0c9d07fd0ff1667e86a2 to your computer and use it in GitHub Desktop.
ansible playbook for deploying a node app on ubuntu
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- hosts: all | |
remote_user: ubuntu | |
vars: | |
app_repo: [email protected]:****/****.git | |
app_id: my_app | |
app_folder: /home/ubuntu/my_app | |
log_folder: /home/ubuntu/my_app_logs | |
tasks: | |
- name: git clone | |
git: repo={{app_repo}} dest={{app_folder}} accept_hostkey=yes force=yes | |
register: app_updated | |
- name: npm install | |
when: app_updated|changed | |
npm: path={{app_folder}} | |
- name: "Restart app" | |
sudo: yes | |
when: app_updated|changed | |
command: forever --uid "{{app_id}}" -al {{log_folder}}/forever.log restart {{app_folder}}/app.js --prod |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment