Override packages used to bootstrap a node

Justin Redd -

There are (at least) two ways you can set where knife bootstrap finds chef packages.

  • Option 1) knife bootstrap --bootstrap-install-command [curl path to your package repository | sudo bash]
  • Option 2) knife bootstrap --bootstrap-url [URL to your own custom install script which happens to use your package repository]

What follows is information to help you decide which of these you want to try.

The source code that controls this is in these two files:

The bootstrap.rb evaluates chef-full.erb to create the bootstrap install script. Option 1) overrides the block of chef-full.erb spanning lines 25 - 36. The key lines here are 29 (wget) & 31 (curl).

  if exists wget; then
    bash <(wget <%= "--proxy=on " if knife_config[:bootstrap_proxy] %> <%= knife_config[:bootstrap_wget_options] %> ${install_sh} -O -) <%= latest_current_chef_version_string %>
  elif exists curl; then
    bash <(curl -L <%= "--proxy \"#{knife_config[:bootstrap_proxy]}\" " if knife_config[:bootstrap_proxy] %> <%= knife_config[:bootstrap_curl_options] %> ${install_sh}) <%= latest_current_chef_version_string %>
  else

You'd be replacing these with your own bash < curl command combo.

If you choose Option 1), I strongly recommend that you have the command in a script that you keep in source control and that you run that script. I suggest calling it something along the lines of [YOUR COMPANY NAME HERE]_bootstrap_node.sh. At it's most minimal it'd contain "knife bootstrap --bootstrap-install-command [YOUR CUSTOM bash < curl command]". To bootstrap your nodes, you'd call this script.

If you use Option 2) to specify your own template, you'd tell bootstrap.rb to skip processing the chef-full.erb and just use the bootstrap script you specify. In this case, I recommend you put your script in source control. The most important thing this script needs to do is the same bash < curl command you'd supply with Option 1). If you have more customization beyond the package location, you may find this option appealing.

Have more questions? Submit a request

Comments

Powered by Zendesk