From 0b291af9e73f8850869860957fd01e1d12e4965c Mon Sep 17 00:00:00 2001 From: Dorian Pula Date: Tue, 18 Nov 2014 08:24:39 -0500 Subject: [PATCH] Reorganize configurations for playbook. Break up playbooks into simpler modular playbooks. --- deployment.yaml | 6 ++++++ deployment/email_server.yaml | 8 ++++++++ deployment/rookeries_install.yaml | 9 +++++++++ deployment/uwsgi.yaml | 7 +++++++ pre_deployment.yaml | 6 ++++++ pre_deployment/base_linux.yaml | 12 ++++++++++++ pre_deployment/mysql_db.yaml | 18 ++++++++++++++++++ pre_deployment/nginx.yaml | 29 +++++++++++++++++++++++++++++ pre_deployment/nodejs.yaml | 6 ++++++ pre_deployment/python.yaml | 20 ++++++++++++++++++++ 10 files changed, 121 insertions(+) create mode 100644 deployment.yaml create mode 100644 deployment/email_server.yaml create mode 100644 deployment/rookeries_install.yaml create mode 100644 deployment/uwsgi.yaml create mode 100644 pre_deployment.yaml create mode 100644 pre_deployment/base_linux.yaml create mode 100644 pre_deployment/mysql_db.yaml create mode 100644 pre_deployment/nginx.yaml create mode 100644 pre_deployment/nodejs.yaml create mode 100644 pre_deployment/python.yaml diff --git a/deployment.yaml b/deployment.yaml new file mode 100644 index 0000000..e895ca6 --- /dev/null +++ b/deployment.yaml @@ -0,0 +1,6 @@ +--- +- hosts: all + sudo: yes + tasks: + + # TODO Include all necessary deployment playbooks diff --git a/deployment/email_server.yaml b/deployment/email_server.yaml new file mode 100644 index 0000000..9264521 --- /dev/null +++ b/deployment/email_server.yaml @@ -0,0 +1,8 @@ +--- +- hosts: all + sudo: yes + tasks: + + # TODO PIP install mailsink into a virtualenv somewhere + - name: Install fake SMTP server for email development. + pip: name=mailsink use_mirrors=no diff --git a/deployment/rookeries_install.yaml b/deployment/rookeries_install.yaml new file mode 100644 index 0000000..608dbed --- /dev/null +++ b/deployment/rookeries_install.yaml @@ -0,0 +1,9 @@ +--- +- hosts: all + sudo: yes + tasks: + + # TODO Step 1 - Setup virtualenv in target + # TODO Step 2 - Copy over package to target system + # TODO Step 3 - PIP install into virtualenv + # TODO Step 4 - Setup environment variables on target system related to config. diff --git a/deployment/uwsgi.yaml b/deployment/uwsgi.yaml new file mode 100644 index 0000000..e9155db --- /dev/null +++ b/deployment/uwsgi.yaml @@ -0,0 +1,7 @@ +--- +- hosts: all + sudo: yes + tasks: + + # TODO Step 1 - PIP install uwsgi into virtualenv + # TODO Step 2 - Start uwsgi with the given configs. diff --git a/pre_deployment.yaml b/pre_deployment.yaml new file mode 100644 index 0000000..34a5555 --- /dev/null +++ b/pre_deployment.yaml @@ -0,0 +1,6 @@ +--- +- hosts: all + sudo: yes + tasks: + + # TODO Include all necessary playbooks diff --git a/pre_deployment/base_linux.yaml b/pre_deployment/base_linux.yaml new file mode 100644 index 0000000..d53e115 --- /dev/null +++ b/pre_deployment/base_linux.yaml @@ -0,0 +1,12 @@ +--- +- hosts: all + sudo: yes + tasks: + + - name: Install vim + apt: pkg=vim update_cache=yes state=present + + - name: Configure vim + copy: src=config/base/_vimrc dest=/home/vagrant/.vimrc + + # TODO Add update of apt cache + any extra repo setup here. diff --git a/pre_deployment/mysql_db.yaml b/pre_deployment/mysql_db.yaml new file mode 100644 index 0000000..2169324 --- /dev/null +++ b/pre_deployment/mysql_db.yaml @@ -0,0 +1,18 @@ +--- +- hosts: all + sudo: yes + tasks: + + # Setup MySQL dependencies. + # TODO Extract all variables into an easy to configure file. + - name: Install MySQL 5x server + apt: pkg=mysql-server update_cache=no state=present + + - name: Install mysqldb is installed. + apt: pkg=python-mysqldb update_cache=no state=present + + - name: Setup MySQL database for rookeries. + mysql_db: name=rookeries state=present + + - name: Setup MySQL database user for rookeries. + mysql_user: name=rookeries password=system_admin priv=rookeries:ALL diff --git a/pre_deployment/nginx.yaml b/pre_deployment/nginx.yaml new file mode 100644 index 0000000..b847fbf --- /dev/null +++ b/pre_deployment/nginx.yaml @@ -0,0 +1,29 @@ +--- +- hosts: all + sudo: yes + tasks: + + # Next setup our webserver. + # TODO Extract variables into a single easy to configure place. + - name: Install nginx + apt: pkg=nginx-full update_cache=yes state=present + + - name: Configure nginx + copy: src=config/nginx/rookeries-uwsgi.conf dest=/etc/nginx/sites-available + + - name: Link the rookeries uwsgi file + file: state=link + src=/etc/nginx/sites-available/rookeries-uwsgi.conf + path=/etc/nginx/sites-enabled/rookeries-uwsgi.conf + + - name: Unlink the default page + file: state=absent path=/etc/nginx/sites-enabled/default + + - name: Run nginx service + command: service nginx restart + + - name: Setup webapp deployment folder with the correct permissions + file: path=/var/www state=directory owner=vagrant group=www-data mode=0774 + + - name: Add vagrant user to www-data + user: name=vagrant append=yes groups=www-data diff --git a/pre_deployment/nodejs.yaml b/pre_deployment/nodejs.yaml new file mode 100644 index 0000000..cbb1302 --- /dev/null +++ b/pre_deployment/nodejs.yaml @@ -0,0 +1,6 @@ +--- +- hosts: all + sudo: yes + tasks: + + # TODO Install nodejs + coffeescript dependencies diff --git a/pre_deployment/python.yaml b/pre_deployment/python.yaml new file mode 100644 index 0000000..b6a066b --- /dev/null +++ b/pre_deployment/python.yaml @@ -0,0 +1,20 @@ +--- +- hosts: all + sudo: yes + tasks: + + # Setup Python dependencies. + - name: Python Development + apt: pkg=python-dev update_cache=no state=present + + - name: Bootstrap Python SetupTools + apt: pkg=python-setuptools update_cache=no state=present + + - name: Bootstrap PIP using Setuptools + easy_install: pkg=pip state=present + + - name: Install Python virtualenvwrapper + pip: name=virtualenvwrapper use_mirrors=no + + - name: Configure Bash to use virtualenvwrapper + lineinfile: dest=/home/vagrant/.bashrc line="source virtualenvwrapper.sh"