From 7f848c713ba18e5df0db755909e778f30d6db889 Mon Sep 17 00:00:00 2001 From: James Turk Date: Wed, 1 Apr 2015 16:29:45 -0400 Subject: [PATCH] Vagrant/ansible stuff --- .gitignore | 1 + .gitmodules | 3 +++ Vagrantfile | 29 +++++++++++++++++++++++++++++ ansible/common-roles | 1 + ansible/db.yml | 12 ++++++++++++ ansible/hosts.vagrant | 1 + lifting/models.py | 3 ++- 7 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 .gitmodules create mode 100644 Vagrantfile create mode 160000 ansible/common-roles create mode 100644 ansible/db.yml create mode 100644 ansible/hosts.vagrant diff --git a/.gitignore b/.gitignore index 49ef255..ef0f701 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ db.sqlite3 +.vagrant diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..f812619 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "ansible-common-roles"] + path = ansible/common-roles + url = git@github.com:sunlightlabs/ansible-common-roles.git diff --git a/Vagrantfile b/Vagrantfile new file mode 100644 index 0000000..77bc91b --- /dev/null +++ b/Vagrantfile @@ -0,0 +1,29 @@ +# vi: set ft=ruby + +VAGRANTFILE_API_VERSION = "2" + +Vagrant.require_version ">= 1.5.0" + +Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| + config.vm.box = "chef/ubuntu-14.10" + + config.vm.define "db" do |db| + db.vm.network "private_network", ip: "10.135.1.101" + + db.vm.provider "virtualbox" do |v| + v.memory = 1024 + v.name = "db.opencivicdata.org" + end + + db.vm.provision "ansible" do |ansible| + ansible.playbook = "ansible/db.yml" + ansible.inventory_path = "ansible/hosts.vagrant" + ansible.limit = "all" + # needed for common tasks to avoid EBS & checkout over synced_folders + ansible.extra_vars = { deploy_type: "vagrant" } + # seems to avoid the delay with private IP not being available + ansible.raw_arguments = ["-T 30"] + end + end +end + diff --git a/ansible/common-roles b/ansible/common-roles new file mode 160000 index 0000000..8ed59fa --- /dev/null +++ b/ansible/common-roles @@ -0,0 +1 @@ +Subproject commit 8ed59fa0bcd1cab8d791ff0fd40a3b51eb497486 diff --git a/ansible/db.yml b/ansible/db.yml new file mode 100644 index 0000000..f62b87a --- /dev/null +++ b/ansible/db.yml @@ -0,0 +1,12 @@ +--- +- name: Install Postgres + hosts: bia-db + user: ubuntu + sudo: yes + roles: + - role: common-roles/common + - role: common-roles/postgres + dbuser: "bia" + dbpassword: "test" + dbname: "bia" + pgversion: 9.4 diff --git a/ansible/hosts.vagrant b/ansible/hosts.vagrant new file mode 100644 index 0000000..041e7b8 --- /dev/null +++ b/ansible/hosts.vagrant @@ -0,0 +1 @@ +bia-db ansible_ssh_host=10.135.1.101 ansible_ssh_user=vagrant diff --git a/lifting/models.py b/lifting/models.py index 734141b..dc1c82d 100644 --- a/lifting/models.py +++ b/lifting/models.py @@ -1,4 +1,5 @@ from django.db import models +from django.contrib.postgres.fields import ArrayField SET_TYPES = ( ('warmup', 'Warmup'), @@ -7,7 +8,7 @@ SET_TYPES = ( class Exercise(models.Model): - name = models.CharField(max_length=200) + names = ArrayField(models.CharField(max_length=200)) def __str__(self): return self.name