Skip to content

Instantly share code, notes, and snippets.

@xacaxulu
Created March 4, 2015 00:54
Show Gist options
  • Save xacaxulu/8e8a9f38783995a9fef0 to your computer and use it in GitHub Desktop.
Save xacaxulu/8e8a9f38783995a9fef0 to your computer and use it in GitHub Desktop.
#
# Cookbook Name:: db2
# Recipe:: default
#
# Copyright (c) 2015 The Authors, All Rights Reserved.
group "db2iadm1" do
end
group "db2fadm1" do
end
user "db2inst1" do
group "db2iadm1"
home "/home/db2inst1"
end
user "db2fenc1" do
group "db2fadm1"
home "/home/db2fenc1"
end
%w{/db2/chf/db2path /db2/chf/db2fs1p0
/db2/chf/db2fs2p0
/db2/chf/db2log1
/db2/chf/db2archive1
/db2/chf/db2bin
/db2/chf/db2bin/IBM/db2/V10.5
/db2/chf/db2stage
/db2/chf/db2stage/response_files
/db2/chf/db2dump
/db2/chf/db2backup1}.each do |dir|
directory dir do
owner 'db2inst1'
group 'db2iadm1'
recursive true
end
end
remote_file "/db2/chf/db2stage/#{node[:db2][:tarball_64]}" do
source node[:db2][:tarball_url_64]
mode '0644'
user 'root'
group 'root'
not_if { ::File.exists?("/db2/chf/db2stage/#{node[:db2][:tarball_64]}")}
end
bash "unzip_file" do
cwd '/db2/chf/db2stage'
code <<-EOH
tar xzvf #{node[:db2][:tarball_64]}
EOH
not_if {::Dir.exists?("/db2/chf/db2stage/expc")}
end
template "/db2/chf/db2stage/response_files/db2exp.rsp" do
source "response.erb"
end
bash 'install_db2' do
cwd '/db2/chf/db2stage/expc'
code <<-EOH
sudo ./db2setup -f sysreq -r /db2/chf/db2stage/response_files/db2exp.rsp
EOH
not_if { ::File.exists?('/db2/chf/db2bin/IBM/db2/V10.5/bin/db2') }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment