Auto Bootstrap Windows Node

I’m trying to create an auto bootstrap script that will install the chef client msi, dynaically create the client.rb file and add the necessary paths. When I run chef-client at the end of my script I get the following error.

INFO: Client key C:\chef\client.pem is not present - registering
FATAL: OpenSSL::X509::CertificateError: nested asn1 error

The bootstrap works when I do it via WinRM.

Thanks

are you trying to do a self bootstrap? is the script running on the node? does the node has your organisations validator on it to bootstrap? https://docs.chef.io/install_bootstrap.html#unattended-installs

The knife bootstrap windows (I assume this is what you are referring to when bootstrapping over winrm) uses the client key on the local workstation or a validator key and uploads it to the node.

For these kinds of auto bootstrapping scenatrios, you need to have a validator key on the node in order for it to obtain a client.pem. The link to the unattended install docs below should walk you through that.

Hi,

I wrote a cookbook that we use in our environment. Maybe it helps you out.

https://supermarket.chef.io/cookbooks/client_bootstrap

If I have to create a data bag for all the nodes, that would be pretty painful. Unless I’m missing something here?

You have to create just the bootstrap DataBag and n DataBag Items for each Node you want to bootstrap.
When you use the Item syntax from the readme file you’ll see it’s pretty easy.