Permalink
Browse files

Add bootstrap template for Freebsd 8.x

  • Loading branch information...
Andrea C. Granata
Andrea C. Granata committed Apr 19, 2011
1 parent 28fa78a commit 7065a0cc7563bfff1f41f3d14c87526f866363cd
Showing with 45 additions and 0 deletions.
  1. +45 −0 chef/lib/chef/knife/bootstrap/freebsd-8.0-gems.erb
@@ -0,0 +1,45 @@
+sh -c '
+if [ ! -f /usr/local/bin/chef-client ]; then
+ setenv PACKAGESITE ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-8-stable/Latest/
+ pkg_add -r ruby18-gems ruby18-iconv
+fi
+rehash
+
+gem install ohai --no-rdoc --no-ri --verbose
+gem install chef --no-rdoc --no-ri --verbose <%= bootstrap_version_string(:gems) %>
+
+mkdir -p /usr/local/etc/chef
+ln -s /usr/local/etc/chef /etc/chef
+
+(
+cat <<'EOP'
+<%= IO.read(Chef::Config[:validation_key]) %>
+EOP
+) > /tmp/validation.pem
+awk NF /tmp/validation.pem > /etc/chef/validation.pem
+rm /tmp/validation.pem
+
+(
+cat <<'EOP'
+log_level :info
+log_location STDOUT
+chef_server_url "<%= Chef::Config[:chef_server_url] %>"
+validation_client_name "<%= Chef::Config[:validation_client_name] %>"
+<% if @config[:chef_node_name] == nil %>
+# Using default node name (fqdn)
+<% else %>
+node_name "<%= @config[:chef_node_name] %>"
+<% end %>
+<% if Chef::Config[:environment] != nil %>
+environment "<%= Chef::Config[:environment]%>"
+<% end %>
+EOP
+) > /etc/chef/client.rb
+
+(
+cat <<'EOP'
+<%= { "run_list" => @run_list }.to_json %>
+EOP
+) > /etc/chef/first-boot.json
+
+/usr/local/bin/chef-client -j /etc/chef/first-boot.json'

0 comments on commit 7065a0c

Please sign in to comment.