Migrate supervisord and web data setup to base nginx-supervisor role.

This commit is contained in:
Dorian 2016-05-14 10:57:42 -04:00
parent 4f0c0dd8f2
commit 0a6e8ac6c4
5 changed files with 10 additions and 68 deletions

View File

@ -13,4 +13,13 @@ galaxy_info:
categories:
- development
- web
dependencies: []
dependencies:
# - role: "git+https://bitbucket.org/dorianpula/ansible-nginx-supervisor,,nginx-supervisor"
- role: "nginx-supervisor"
nsbase_app_name: "{{ app_name }}"
nsbase_app_root_path: "{{ app_root_path }}"
nsbase_app_nginx_hostname: "{{ app_nginx_hostname }}"
nsbase_app_service_name: "{{ uwsgi_app_service_name }}"
nsbase_app_service_command: "{{ uwsgi_venv }}/bin/uwsgi --ini {{ uwsgi_config_path }}/{{ uwsgi_app_ini }}"
nsbase_app_service_stop_signal: QUIT
nsbase_nginx_app_config: "{{ app_name }}_uwsgi_nginx.conf"

View File

@ -1,7 +1,5 @@
---
# tasks file for ansible-nginx-uwsgi-supervisor
- include: nginx.yaml
- include: supervisor.yaml
- include: web_data_folders.yaml
- include: python.yaml
- include: uwsgi.yaml

View File

@ -1,25 +0,0 @@
---
- name: install supervisord
apt: name=supervisor state=present
sudo: yes
- name: set permissions on supervisor config and log directories
file: path={{ item }} group={{ web_server_group }} state=directory mode=0755
with_items:
- /etc/supervisor
- /etc/supervisor/conf.d
- /var/log/supervisor
sudo: yes
- name: modify supervisor configuration
ini_file: dest=/etc/supervisor/supervisord.conf section=unix_http_server
option={{ item.key }} value={{ item.value }}
with_dict:
chmod: "0770"
chown: root:{{ web_server_group }}
sudo: yes
- name: upload supervisor configuration to web server home
template: src=supervisor/app_supervisor.conf dest=/etc/supervisor/conf.d/{{ supervisor_app_config }}
sudo: yes
notify: start supervisord

View File

@ -1,31 +0,0 @@
---
- name: setup webapp deployment folder with the correct permissions
file: path={{ web_root_path }} state=directory
owner={{ web_server_group }} group={{ web_server_group }} mode=0774
sudo: yes
- name: setup webapp deployment configuration + log folders with the correct permissions
file: path={{ web_root_path }}/{{ item }} state=directory
owner={{ web_server_group }} group={{ web_server_group }} mode=0774
with_items:
- config
- config/uwsgi
- logs
- virtualenvs
sudo: yes
- name: link remote folders with webapp home folder
file: state=link
path={{ web_root_path }}/{{ 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
sudo: yes
- name: add user to webserver group
user: name={{ web_user }} append=yes groups={{ web_server_group }}
sudo: yes

View File

@ -1,9 +0,0 @@
; UWSGI for {{ app_name }}
[program:{{ uwsgi_app_service_name }}]
user={{ web_server_group }}
command={{ uwsgi_venv }}/bin/uwsgi --ini {{ uwsgi_config_path }}/{{ uwsgi_app_ini }}
stopsignal=QUIT
stdout_logfile = {{ web_root_path }}/logs/supervisor/{{ app_name }}-application.log
stdout_logfile_backups = 5
stderr_logfile = {{ web_root_path }}/logs/supervisor/{{ app_name }}-error.log
stderr_logfile_backups = 5