Greetings Professionals ,
I have like more than 50 windows machines with different local host names and different passwords i have been trying to register manually by executing bootstrapping command 50 times for each windows server and make them register on my chef automate server and its like pain in the neck… can any one please help me in avoiding this situation and im sure there will be a possibility to automate this in a single shot but im not aware of …or is there any cookbooks for this move provided?
Below are the example
Can you please give me an example how to perform the script…by taking these windows machines as example
10.0.10.1 password : aqxwey
10.0.10.2 password : ijzzxy
10.0.10.3 password :pytyttsz
I have been using this command to bootstrap each and every windows manchine for 50 times to get all nodes registered to chefautomate server
knife bootstrap windows winrm 10.0.10.1 -x ‘stmsltapp31d\Administrator’ -P ‘N7eqkqv?ds(’ -N stlmsltapp31d
This would depend on what the machine is you are running the bootstrap commands?
You could just fill out a simple CSV file with 2 column minimum (I would add a name & possibly a username column as well depending if the need is there) and ‘foreach loop’ through them all using Powershell on windows.
CSV would look like:
Name IP Pass User
node1 192.168.1.1 Pass01 domain1\user1
node2 192.168.1.2 Pass02 domain2\user2
The import the CSV into a variable:
$nodes = Import-Csv -Path c:\mynodes.csv
Then we need to ForEach loop through each of them (*** Disclaimer*** I haven’t tested this):
foreach ($node.name in $nodes)
# Output the node name to the console
Write-Host "Bootstraping machine $node.name"
# Bootstrap the node
knife bootstrap windows winrm $node.ip-x $node.user -P $node.pass -N $node.name
Thank you for your valuable time and patience for giving me the solution , i have been using linux machine to run the bootstrap commands . is it possible to perform the above task from linux machine or should i have to do that particularly on windows? please guide me …
It would most def be possible, but as I am not as proficient in BASH as I am PowerShell you would need to do a little research on this.
Have a read of this for creating an array from the CSV file.
Have a read through this to see how to loop through an array in bash.
Hopefully you can put the info together to meet your needs…