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

35 lines
1.2 KiB
YAML

---
- hosts: all
sudo: yes
vars:
user: "{{ ansible_env.SUDO_USER }}"
web_app_home: /srv/www
web_server_group: www-data
tasks:
- name: setup webapp deployment folder with the correct permissions
file: path={{ web_app_home }} state=directory owner={{ web_server_group }} group=www-data mode=0774
- name: setup webapp deployment configuration + log folders with the correct permissions
file: path={{ web_app_home }}/{{ item }} state=directory
owner={{ web_server_group }} group={{ web_server_group }} mode=0774
with_items:
- config
- config/uwsgi
- logs
- virtualenvs
- name: setup webapp deployment configuration + log folders with the correct permissions
file: state=link
path={{ web_app_home }}/{{ item.value }}
src={{ item.key }}
owner={{ web_server_group }} group={{ web_server_group }} mode=0774
with_dict:
/etc/nginx: config/nginx
/etc/supervisor: config/supervisor
/var/log/nginx: logs/nginx
/var/log/supervisor: logs/supervisor
- name: add user to www-data
user: name={{ user }} append=yes groups={{ web_server_group }}