Forked from JulienSansot/ansible playbook for deploying a node app on ubuntu
Created
July 9, 2016 18:13
-
-
Save cwonrails/5ea4a4bf297b19773144d039d26f8ec2 to your computer and use it in GitHub Desktop.
ansible playbook for deploying a node app on ubuntu
This file contains hidden or 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: git@bitbucket.org:****/****.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