Chef Knife Node Bootstrap Example Command

Whilst the documentation around the knife bootstrap command is brilliant, I learn better by example/doing, so here’s an example of the syntax I use when bootstrapping new nodes within my infrastructure.

There are variants to this which don’t use the password in the command line, and there are certainly pre-requisites that need to be satisfied before you can just go ahead and register a node against your Chef server, however with that said here’s the command I’ve used most recently:

knife bootstrap {NODE_IP_ADDRESS} -x {USER} -P {PASSWORD}-E {ENVIRONMENT} -N {NODE_NAME} -r 'role[webserver]'

A complete command would look something similar to this:

knife bootstrap -x root -P Jhgt5iJ8y -E production -N web-interface02 -r 'role[webserver]'

Hope this helps someone in a pinch, the mental block can be strong at times.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.