Permalink
Browse files

Provisioning a vm, next step is to deploy to this vm as if it were a

production environment
  • Loading branch information...
chischaschos committed Mar 6, 2014
1 parent 7b73b7d commit 1f1947f05e1ca23c018b639f6575f13bdafc9139
View
@@ -35,3 +35,6 @@ customize its configuration.
- Responsive layouts
- Full JS app consuming API
- Try to improve code so that codeclimate becomes happier [![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/chischaschos/scanty)
+
+## Provisioning
+Based on https://github.com/radar/ansible-rails-app
View
@@ -0,0 +1,16 @@
+# -*- mode: ruby -*-
+# vi: set ft=ruby :
+
+# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
+VAGRANTFILE_API_VERSION = '2'
+
+Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
+ config.vm.box = 'precise64'
+
+ #config.vm.network 'private_network', ip: '192.168.50.4'
+
+ config.vm.provision 'ansible' do |ansible|
+ ansible.playbook = 'provisioning/site.yml'
+ ansible.inventory_path = 'ansible'
+ end
+end
View
@@ -0,0 +1,2 @@
+[Vagrant]
+default ansible_ssh_host=127.0.0.1 ansible_ssh_port=2222 ansible_ssh_user=vagrant ansible_ssh_private_key_file=~/.vagrant.d/insecure_private_key
@@ -0,0 +1 @@
+- include: postgresql.yml tags=postgresql
@@ -0,0 +1,31 @@
+- name: Install PostgreSQL dependencies
+ action: apt pkg={{item}} state=latest
+ with_items:
+ - python-pycurl
+ - python-psycopg2
+
+- name: Add PostgreSQL repo key
+ apt_key: url=http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc
+
+- name: Add PostgreSQL repo
+ apt_repository: repo='deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main'
+
+- name: Install PostgreSQL
+ apt: pkg=postgresql-9.3 state=latest update_cache=true
+
+- name: Copy valid pg_hba.conf
+ template: src=pg_hba.conf.j2 dest=/etc/postgresql/9.3/main/pg_hba.conf
+
+- name: Copy valid postgresql.conf
+ template: src=postgresql.conf.j2 dest=/etc/postgresql/9.3/main/postgresql.conf
+
+- name: Restart PostgreSQL
+ command: service postgresql restart
+
+- name: create the postgresql user for application
+ postgresql_user: name=deploy
+ sudo_user: postgres
+
+- name: create the postgresql database for application
+ postgresql_db: name=app_{{app_name}} owner=deploy state=present
+ sudo_user: postgres
@@ -0,0 +1,5 @@
+local all all peer
+host all all 127.0.0.1/32 md5
+host all all ::1/128 md5
+host all all 10.11.12.0/24 md5
+
Oops, something went wrong.

0 comments on commit 1f1947f

Please sign in to comment.