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 20.65.222.124 -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