ansible-nginx-uwsgi-supervisor/pre_deployment/nginx.yaml

33 lines
1.0 KiB
YAML

---
- hosts: all
sudo: yes
vars:
rookeries_nginx_conf: rookeries-uwsgi.conf
web_server_group: www-data
web_server_home: /srv/www
tasks:
- name: Setup nginx webserver
apt: pkg=nginx-full state=present
- name: Configure nginx
copy: src=../config/nginx/{{ rookeries_nginx_conf }} dest=/etc/nginx/sites-available
- name: Link the rookeries uwsgi file
file: state=link
src=/etc/nginx/sites-available/{{ rookeries_nginx_conf }}
path=/etc/nginx/sites-enabled/{{ rookeries_nginx_conf }}
- name: Unlink the default page
file: state=absent path=/etc/nginx/sites-enabled/default
- name: Run nginx service
command: service nginx restart
- name: Setup webapp deployment folder with the correct permissions
file: path={{ web_server_home }} state=directory
owner={{ ansible_env.SUDO_USER }} group={{ web_server_group }} mode=0774
- name: Add vagrant user to www-data
user: name={{ ansible_env.SUDO_USER }} append=yes groups={{ web_server_group }}