summaryrefslogtreecommitdiff
path: root/lib/chef/knife
diff options
context:
space:
mode:
authorSerdar Sutay <serdar@opscode.com>2014-05-20 16:20:39 -0700
committerSerdar Sutay <serdar@opscode.com>2014-05-20 16:20:39 -0700
commit92519eb2cf7ae1b362f22d5710a229c5809a47cc (patch)
tree254ed19d2768de03f6cf1f404d03ccaca41aeeca /lib/chef/knife
parentc025564274d2473e7736626679a08a7e2617090a (diff)
parent85bcc3c2ad7734e7324ae72dbf3d8fc1325fedd4 (diff)
downloadchef-92519eb2cf7ae1b362f22d5710a229c5809a47cc.tar.gz
Merge pull request #1032 from ClogenyTechnologies/kd/aix-bootstrap
OC-9274 - Knife bootstrap support for AIX
Diffstat (limited to 'lib/chef/knife')
-rw-r--r--lib/chef/knife/bootstrap/chef-aix.erb58
1 files changed, 58 insertions, 0 deletions
diff --git a/lib/chef/knife/bootstrap/chef-aix.erb b/lib/chef/knife/bootstrap/chef-aix.erb
new file mode 100644
index 0000000000..59993b478a
--- /dev/null
+++ b/lib/chef/knife/bootstrap/chef-aix.erb
@@ -0,0 +1,58 @@
+ksh -c '
+
+function exists {
+ if type $1 >/dev/null 2>&1
+ then
+ return 0
+ else
+ return 1
+ fi
+}
+
+if ! exists /usr/bin/chef-client; then
+ <% if @chef_config[:aix_package] -%>
+ # Read the download URL/location from knife.rb with option aix_package
+ rm -rf /tmp/chef_installer # ensure there no older pkg
+ echo "<%= @chef_config[:aix_package] %>"
+ perl -e '\''use LWP::Simple; getprint($ARGV[0]);'\'' <%= @chef_config[:aix_package] %> > /tmp/chef_installer
+ installp -aYF -d /tmp/chef_installer chef
+ <% else -%>
+ echo ":aix_package location is not set in knife.rb"
+ exit
+ <% end -%>
+fi
+
+mkdir -p /etc/chef
+
+cat > /etc/chef/validation.pem <<'EOP'
+<%= validation_key %>
+EOP
+chmod 0600 /etc/chef/validation.pem
+
+<% if encrypted_data_bag_secret -%>
+cat > /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 %>'