2
votes

My question is regarding BootStrapping and running Chef builds on a given node.

Say I bootstrapped a machine using the following command:

knife bootstrap <FQDN or IP Address> -x root -r "recipe[myRecipe]" --sudo -E environmentFile

Questions:

  1. Is it a good practice to do consequent deployment using the above knife bootstrap command?
  2. Is using the following command better over knife bootstrap:

    knife ssh <FQDN or IP Address> 'sudo chef-client' --manual-list "recipe[myRecipe]" -x root -E environmentFile
    

    ?

2

2 Answers

1
votes

knife ssh is for running commands in on several machines. As such, you don't give it a single hostname, it takes a Chef search query as a parameter. As you might expect, knife bootstrap is the correct way to bootstrap things.

0
votes

knife bootstrap command is use only once when you need to register your node with chef server, however it has feauture to run the recipes at the time of bootstrap too. So if you running below command

"knife bootstrap <FQDN or IP Address> -x root -r "recipe[myRecipe]" --sudo -E environmentFile"

there is no issue, however sometime you need to execute some recipes after manual intervention on all machines in that case you should use

knife ssh "serachquery" 'chef-client -o recipe[myRecipe]' -x root

it will run the provided recipe on all machine. Knife ssh command will need to run every time u need to deploy ur changes not knife bootstrap command.