Last active
September 15, 2016 20:18
-
-
Save kevinlondon/01a45e1f5ddd398fe8b10f2f919a45dd to your computer and use it in GitHub Desktop.
Initial site.yml
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
- name: Configure application | |
hosts: all | |
become: true | |
become_method: sudo | |
vars: | |
repository_url: https://github.com/kevinlondon/flask-hello-world.git | |
repository_path: /home/vagrant/flask-hello-world | |
tasks: | |
- name: Install packages | |
apt: update_cache=yes name={{ item }} state=present | |
with_items: | |
- git | |
- python-pip | |
- nginx | |
- name: Clone repository | |
git: repo='{{ repository_url }}' dest='{{ repository_path }}' | |
- name: Install requirements | |
pip: requirements='{{ repository_path }}/requirements.txt' | |
- name: Copy Upstart configuration | |
template: src=hello-world.upstart.j2 dest=/etc/init/hello-world.conf | |
notify: | |
- restart hello-world | |
- name: Make sure our server is running | |
service: name=hello-world state=started | |
- name: Copy Nginx site | |
template: src=hello-world.nginx.j2 dest=/etc/nginx/sites-enabled/hello-world | |
notify: | |
- restart nginx | |
- name: Remove any default sites | |
file: path=/etc/nginx/sites-enabled/default state=absent | |
notify: | |
- restart nginx | |
- name: Make sure nginx is running | |
service: name=nginx state=started | |
handlers: | |
- name: restart nginx | |
service: name=nginx state=restarted | |
- name: restart hello-world | |
service: name=hello-world state=restarted |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment