Advance Tcp/Ip DNS entries


#1

Greetings Professionals

Is there any cookbook available that updates and enters the IP’s , advance TCP/IP and DNS settings for windows servers?

Below is the Screenshot for which we need to update the New ips and settings accordingly for more than windows 100+ nodes is there any way to get this done through chef?

image

image

Please help…!

Thanks
Prash


#2

There are no native chef resources for managing DNS settings, however chef can manage powershell commands

Here is an example of how you might set your dns servers (code untested and likely wont work as is).

powershell_script 'set dns' do
  code 'Set-DNSClientServerAddress –interfaceIndex 12 –ServerAddresses ("10.0.0.1","10.0.0.2")'
  not_if "Get-DNSClientServerAddress -interfaceIndex 12 -eq "10.0.0.1" -and Get-DNSClientServerAddress -interfaceIndex 12  -eq "10.0.0.2"
  action :run
end

Note the not_if attribute that prevents chef from overwriting the settings if they are already in the desired state.


#3

We use the following cookbook for many of those settings on Windows - https://supermarket.chef.io/cookbooks/network_interfaces_v2 - it works well for our needs.

~bob