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