From 862d73268a9cc4eb1da300cc4bda1704f5c9be9f Mon Sep 17 00:00:00 2001 From: Dorian Pula Date: Fri, 9 Jan 2015 07:46:01 -0500 Subject: [PATCH] Remove duplicate webapp home variable, to simplify setup. Remove references to Rookeries and rename variables, to make role useful outside of the context of Rookeries. --- tasks/nginx.yaml | 9 +++++---- tasks/python.yaml | 6 +++--- tasks/uwsgi.yaml | 4 ++-- tasks/web_data_folders.yaml | 2 +- vars/main.yml | 21 ++++++++++----------- 5 files changed, 21 insertions(+), 21 deletions(-) diff --git a/tasks/nginx.yaml b/tasks/nginx.yaml index b78fb7c..a5eeeec 100644 --- a/tasks/nginx.yaml +++ b/tasks/nginx.yaml @@ -3,13 +3,14 @@ apt: pkg=nginx-full state=present sudo: yes +# TODO Look at using templated configuration - name: configure nginx - copy: src=nginx/{{ rookeries_nginx_conf }} dest=/etc/nginx/sites-available + copy: src=nginx/{{ app_nginx_conf }} dest=/etc/nginx/sites-available -- name: enable the rookeries nginx configuration +- name: enable the copied over nginx configuration file: state=link - src=/etc/nginx/sites-available/{{ rookeries_nginx_conf }} - path=/etc/nginx/sites-enabled/{{ rookeries_nginx_conf }} + src=/etc/nginx/sites-available/{{ app_nginx_conf }} + path=/etc/nginx/sites-enabled/{{ app_nginx_conf }} sudo: yes - name: disable the default page configuration diff --git a/tasks/python.yaml b/tasks/python.yaml index c09b441..d474e0f 100644 --- a/tasks/python.yaml +++ b/tasks/python.yaml @@ -1,15 +1,15 @@ --- -- name: install Python setuptools dependencies +- name: install python dev dependencies sudo: yes apt: pkg={{ item }} state=present with_items: - python-dev - python-setuptools -- name: bootstrap PIP using setuptools +- name: bootstrap pip using setuptools sudo: yes easy_install: name=pip -- name: install Python virtualenv +- name: install virtualenv sudo: yes pip: name=virtualenv diff --git a/tasks/uwsgi.yaml b/tasks/uwsgi.yaml index 4e33ed4..d86e3f7 100644 --- a/tasks/uwsgi.yaml +++ b/tasks/uwsgi.yaml @@ -3,8 +3,8 @@ pip: name=uwsgi virtualenv={{ uwsgi_venv }} version=2.0 sudo: yes -- name: upload rookeries configuration - copy: src=uwsgi/{{ rookeries_uwsgi_ini }} dest={{ uwsgi_config }} +- name: upload app's uwsgi configuration + copy: src=uwsgi/{{ uwsgi_ini }} dest={{ uwsgi_config }} sudo: yes - name: restart uwsgi server diff --git a/tasks/web_data_folders.yaml b/tasks/web_data_folders.yaml index bcc42d5..e55420e 100644 --- a/tasks/web_data_folders.yaml +++ b/tasks/web_data_folders.yaml @@ -25,6 +25,6 @@ /var/log/supervisor: logs/supervisor sudo: yes -- name: add user to www-data +- name: add user to webserver group user: name={{ user }} append=yes groups={{ web_server_group }} sudo: yes diff --git a/vars/main.yml b/vars/main.yml index b8fac10..f78d6de 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -2,9 +2,14 @@ # vars file for ansible-nginx-uwsgi-supervisor # TODO Make more configurable and flexible -# NGINX -rookeries_nginx_conf: rookeries-uwsgi_nginx.conf + +# Web app home + group +web_app_home: /srv/www web_server_group: www-data +user: "{{ ansible_env.SUDO_USER }}" + +# NGINX +app_nginx_conf: rookeries-uwsgi_nginx.conf # Supervisor # TODO Allow for multiple supervisord configurations @@ -12,13 +17,7 @@ supervisor_configs: # - mailsink_supervisor.conf - rookeries_supervisor.conf -web_server_home: /srv/www - # UWSGI -uwsgi_venv: "{{ web_server_home }}/virtualenvs/uwsgi" -uwsgi_config: "{{ web_server_home }}/config/uwsgi" -rookeries_uwsgi_ini: rookeries-uwsgi.ini - -# Web folders -user: "{{ ansible_env.SUDO_USER }}" -web_app_home: /srv/www +uwsgi_venv: "{{ web_app_home }}/virtualenvs/uwsgi" +uwsgi_config: "{{ web_app_home }}/config/uwsgi" +uwsgi_ini: rookeries-uwsgi.ini