summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkaustubh-d <kaustubh@clogeny.com>2013-09-30 15:48:50 +0530
committerkaustubh-d <kaustubh@clogeny.com>2013-09-30 15:48:50 +0530
commitceca2032886db1cfd6bcd980305e21d5c616eee9 (patch)
treefaae15bde9b5f5eea758610d2750942ba158696e
parent008973c3c0b5598eed5f8d649c3eb8c6adf9325a (diff)
downloadchef-ceca2032886db1cfd6bcd980305e21d5c616eee9.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 %>