Integrate deployment of rookeries web application into rolebook.

This commit is contained in:
Dorian 2015-03-11 22:09:54 -04:00
parent 5c8402c98e
commit 2a4142f2b5
4 changed files with 39 additions and 30 deletions

View File

@ -1,30 +0,0 @@
---
- hosts: all
sudo: yes
vars:
web_server_home: /srv/www
web_server_group: www-data
rookeries_venv: "{{ web_server_home }}/virtualenvs/rookeries"
rookeries_package: rookeries-0.4.0.tar.bz2
tasks:
- name: upload + extract rookeries package to web server home
unarchive: src=../../../{{ rookeries_package }} dest={{ web_server_home }}/
- name: install rookeries dependencies
pip: requirements=rookeries_webapp/requirements.txt virtualenv={{ rookeries_venv }} chdir={{ web_server_home }}
- name: install extra MySQL python connector dependency
pip: name=mysql-connector-python virtualenv={{ rookeries_venv }} version=1.1.6
extra_args='--allow-external mysql-connector-python --allow-unverified mysql-connector-python'
- name: fix permissions on extracted web app
file: path={{ web_server_home }}/rookeries_webapp owner={{ web_server_group }} group={{ web_server_group }}
state=directory recurse=yes
# TODO Step 4 - Setup environment variables on target system related to config.
- name: install bower dependencies in app
command: bower install --allow-root --quiet chdir={{ web_server_home }}/rookeries_webapp
# TODO Replace with bower command in future version of Ansible (1.9.0)
# bower: path={{ web_server_home }}/rookeries_webapp state=present

View File

@ -2,3 +2,4 @@
- include: mysql_db.yaml - include: mysql_db.yaml
- include: nodejs.yaml - include: nodejs.yaml
- include: dev_email_server.yaml - include: dev_email_server.yaml
- include: rookeries_deployment.yaml

View File

@ -0,0 +1,31 @@
---
- name: upload + extract rookeries package to web server home
unarchive: src={{ rookeries_package_path }} dest={{ web_root_path }}
sudo: yes
register: ready_to_deploy
ignore_errors: True
- command: echo Hello {{ app_root_path }}
- name: install rookeries dependencies
pip: requirements=requirements.txt virtualenv={{ rookeries_venv }} chdir={{ app_root_path }}
when: ready_to_deploy|success
- name: install extra MySQL python connector dependency
pip: name=mysql-connector-python virtualenv={{ rookeries_venv }} version=1.1.6
extra_args='--allow-external mysql-connector-python --allow-unverified mysql-connector-python'
when: ready_to_deploy|success
- name: fix permissions on extracted web app
file: path={{ app_root_path }} owner={{ web_server_group }} group={{ web_server_group }}
state=directory recurse=yes
when: ready_to_deploy|success
# TODO Step 4 - Setup environment variables on target system related to config.
- name: install bower dependencies in app
command: bower install --allow-root --quiet chdir={{ web_root_path }}/rookeries_webapp
notify: restart uwsgi app
when: ready_to_deploy|success
# TODO Replace with bower command in future version of Ansible (1.9.0)
# bower: path={{ app_root_path }} state=present

View File

@ -7,8 +7,15 @@ databases:
# TODO Move into defaults/main.yaml # TODO Move into defaults/main.yaml
rookeries_app_name: rookeries rookeries_app_name: rookeries
app_name: "{{ rookeries_app_name }}"
# The mode of the setup. Setting to "dev" enables the use of a SMTP fake server to help with development. # The mode of the setup. Setting to "dev" enables the use of a SMTP fake server to help with development.
# TODO Move into defaults/main.yaml # TODO Move into defaults/main.yaml
rookeries_environ_type: dev rookeries_environ_type: dev
rookeries_dev_email_server_venv: "{{ virtualenv_root_path }}/mail_server" rookeries_dev_email_server_venv: "{{ virtualenv_root_path }}/mail_server"
# Introduced from deployment playbook
# TODO Reorganize everything
rookeries_venv: "{{ virtualenv_root_path }}/rookeries"
rookeries_package: rookeries-0.4.0.tar.bz2
rookeries_package_path: "../../{{ rookeries_package }}"