summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkaustubh-d <kaustubh@clogeny.com>2013-09-30 15:48:50 +0530
committerkaustubh-d <kaustubh@clogeny.com>2013-10-08 12:32:08 +0530
commit0f29ed89f4ca0166d769b142c3c3acd32f83701f (patch)
treed3ede99421489981d7ca70cca2dcd579c093674e
parent5be79cb1396c302bab88cdba36528e70047040cd (diff)
downloadchef-0f29ed89f4ca0166d769b142c3c3acd32f83701f.tar.gz
aix: bootstrap template for aix.
-rw-r--r--lib/chef/knife/bootstrap/chef-on-aix.erb49
1 files changed, 49 insertions, 0 deletions
diff --git a/lib/chef/knife/bootstrap/chef-on-aix.erb b/lib/chef/knife/bootstrap/chef-on-aix.erb
new file mode 100644
index 0000000000..1d37a58389
--- /dev/null
+++ b/lib/chef/knife/bootstrap/chef-on-aix.erb
@@ -0,0 +1,49 @@
+#!/bin/ksh
+<%= "export http_proxy=\"#{knife_config[:bootstrap_proxy]}\"" if knife_config[:bootstrap_proxy] -%>
+
+if ! [[ -e /usr/bin/chef-client ]] ; then
+ <% if @chef_config[:aix_package] -%>
+ # Read the download URL/location from knife.rb with option aix_package
+ # For now just install from local, TODO - fetch from download URL
+ # perl -e 'use LWP::Simple; getprint($ARGV[0]);' package_url > /tmp/chef-install_file
+ installp -aYF -d <%= @chef_config[:aix_package] %> chef
+ <% else -%>
+ echo ":aix_package location is not set in knife.rb"
+ exit
+ <% end -%>
+fi
+
+mkdir -p /etc/chef
+
+awk NF > /etc/chef/validation.pem <<'EOP'
+<%= validation_key %>
+EOP
+chmod 0600 /etc/chef/validation.pem
+
+<% if @chef_config[:encrypted_data_bag_secret] -%>
+awk NF > /etc/chef/encrypted_data_bag_secret <<'EOP'
+<%= encrypted_data_bag_secret %>
+EOP
+chmod 0600 /etc/chef/encrypted_data_bag_secret
+<% end -%>
+
+<%# Generate Ohai Hints -%>
+<% unless @chef_config[:knife][:hints].nil? || @chef_config[:knife][:hints].empty? -%>
+mkdir -p /etc/chef/ohai/hints
+
+<% @chef_config[:knife][:hints].each do |name, hash| -%>
+cat > /etc/chef/ohai/hints/<%= name %>.json <<'EOP'
+<%= hash.to_json %>
+EOP
+<% end -%>
+<% end -%>
+
+cat > /etc/chef/client.rb <<'EOP'
+<%= config_content %>
+EOP
+
+cat > /etc/chef/first-boot.json <<'EOP'
+<%= first_boot.to_json %>
+EOP
+
+<%= start_chef %>