From f3335e104efded77fee241ee3aa858c84d1a7f2b Mon Sep 17 00:00:00 2001 From: Antonio Terceiro Date: Mon, 9 Feb 2015 16:06:34 -0200 Subject: [PATCH] Initial DB setup --- cookbooks/basics/recipes/default.rb | 5 +++++ cookbooks/basics/templates/centos/hosts.erb | 6 ++++++ cookbooks/postgresql/recipes/default.rb | 9 +++++++++ test/postgresql_test.sh | 8 ++++++++ 4 files changed, 28 insertions(+), 0 deletions(-) create mode 100644 cookbooks/basics/templates/centos/hosts.erb create mode 100644 cookbooks/postgresql/recipes/default.rb create mode 100644 test/postgresql_test.sh diff --git a/cookbooks/basics/recipes/default.rb b/cookbooks/basics/recipes/default.rb index f804a58..86a17e2 100644 --- a/cookbooks/basics/recipes/default.rb +++ b/cookbooks/basics/recipes/default.rb @@ -7,3 +7,8 @@ if node['platform'] == 'centos' mode 0644 end end + +template '/etc/hosts' do + owner 'root' + mode 0644 +end diff --git a/cookbooks/basics/templates/centos/hosts.erb b/cookbooks/basics/templates/centos/hosts.erb new file mode 100644 index 0000000..7330fe1 --- /dev/null +++ b/cookbooks/basics/templates/centos/hosts.erb @@ -0,0 +1,6 @@ +127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 +::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 + +<% node['peers'].each do |hostname,ip| %> +<%= ip %> <%= hostname %> +<% end %> diff --git a/cookbooks/postgresql/recipes/default.rb b/cookbooks/postgresql/recipes/default.rb new file mode 100644 index 0000000..e93169e --- /dev/null +++ b/cookbooks/postgresql/recipes/default.rb @@ -0,0 +1,9 @@ +package 'postgresql-server' + +execute 'postgresql-setup initdb || true' do + notifies :start, 'service[postgresql]' +end + +service 'postgresql' do + action :start +end diff --git a/test/postgresql_test.sh b/test/postgresql_test.sh new file mode 100644 index 0000000..f8311d0 --- /dev/null +++ b/test/postgresql_test.sh @@ -0,0 +1,8 @@ +. $(dirname $0)/test_helper.sh + +test_postgresql_running() { + assertTrue 'PostgreSQL running' 'run_on database pgrep -fa postgres' +} + +. shunit2 + -- libgit2 0.21.2