-
-
Save benjaminws/1276345 to your computer and use it in GitHub Desktop.
# shove this in ~/.chef/bootstrap/joyent-smartos.erb | |
# run knife bootstrap <hostname> -d joyent-smartos | |
bash -c ' | |
if [ ! -f /opt/local/bin/chef-client ]; then | |
cd /tmp | |
pkgin install gcc-compiler gcc-runtime gcc-tools-0 ruby19 scmgit-base scmgit-docs gmake sun-jdk6 | |
wget http://production.cf.rubygems.org/rubygems/rubygems-1.8.10.tgz | |
tar -xzf rubygems-1.8.10.tgz | |
cd rubygems-1.8.10 | |
ruby setup.rb --no-format-executable | |
gem install --no-ri --no-rdoc json_pure | |
gem install --no-ri --no-rdoc -v=0.9.18 chef | |
mv /opt/local/lib/ruby/gems/1.9/gems/json-1.4.6 /tmp/ | |
ln -s /opt/local/lib/ruby/gems/1.9/gems/json_pure-1.6.1 /opt/local/lib/ruby/gems/1.9/gems/json-1.4.6 | |
fi | |
mkdir -p /etc/chef | |
( | |
cat <<'EOP' | |
<%= validation_key %> | |
EOP | |
) > /tmp/validation.pem | |
awk NF /tmp/validation.pem > /etc/chef/validation.pem | |
rm /tmp/validation.pem | |
( | |
cat <<'EOP' | |
<%= config_content %> | |
EOP | |
) > /etc/chef/client.rb | |
( | |
cat <<'EOP' | |
<%= { "run_list" => @run_list }.to_json %> | |
EOP | |
) > /etc/chef/first-boot.json | |
' |
You know, I created this before Joyent rebooted the brand and released the newest smartos. I'm not sure if it will even work anymore.
However, I'll give it a quick shot. You're running this in server mode, not with chef-solo, right? It seems like it's not creating the chef validation.pem. Can you make sure the user you're running it as can create /etc/chef? Just a shot in the dark.
Thanks for the info. I'm just starting to learn Chef and was thinking from a Chef-solo perspective if that makes any sense. I now understand that knife bootstrap is for bootstraping nodes when you already have a Chef server (and hence a pem). Need to read more, but I'm glad someone else has tried this:
FYI: I'm actually running my own SmartOS servers, but this was essentially in a SmartMachine. http://smartos.org.
Cheers,
GF
Hey thanks for this. I just ran it successfully on a new SmartOS node after making a couple of small tweaks (see my fork at https://gist.github.com/1753987 -- had to add '-y' to pkgin to avoid interactive prompts, and removed sun-jdk6 because I couldn't come up with a way to get it to run non-interactively.)
Hi,
I'm trying to get Chef working with a Joyent SmartOS zone.Was hoping to use your bootstrap template. I've install the chef gem follow your instructions and get:
WARNING: No knife configuration file found
Bootstrapping Chef on 0edd613
ERROR: Errno::ENOENT: No such file or directory - /etc/chef/validation.pem
I must be missing something?