From 0a6e8ac6c4f193dae0fc647dfa2010b88a612934 Mon Sep 17 00:00:00 2001 From: Dorian Pula Date: Sat, 14 May 2016 10:57:42 -0400 Subject: [PATCH] Migrate supervisord and web data setup to base nginx-supervisor role. --- meta/main.yml | 11 ++++++++- tasks/main.yml | 2 -- tasks/supervisor.yaml | 25 ------------------- tasks/web_data_folders.yaml | 31 ------------------------ templates/supervisor/app_supervisor.conf | 9 ------- 5 files changed, 10 insertions(+), 68 deletions(-) delete mode 100644 tasks/supervisor.yaml delete mode 100644 tasks/web_data_folders.yaml delete mode 100644 templates/supervisor/app_supervisor.conf diff --git a/meta/main.yml b/meta/main.yml index 4c3c473..1314387 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -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" diff --git a/tasks/main.yml b/tasks/main.yml index 9cba9eb..119d37b 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -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 diff --git a/tasks/supervisor.yaml b/tasks/supervisor.yaml deleted file mode 100644 index 6069d5b..0000000 --- a/tasks/supervisor.yaml +++ /dev/null @@ -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 diff --git a/tasks/web_data_folders.yaml b/tasks/web_data_folders.yaml deleted file mode 100644 index 94d5fec..0000000 --- a/tasks/web_data_folders.yaml +++ /dev/null @@ -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 diff --git a/templates/supervisor/app_supervisor.conf b/templates/supervisor/app_supervisor.conf deleted file mode 100644 index 553740b..0000000 --- a/templates/supervisor/app_supervisor.conf +++ /dev/null @@ -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