Setting things up

Up until now, you could have gotten away with just looking at the examples in the book without running them or adapting them slightly to work on your desktop or a test VM or server. At this point, it is really helpful to have a test VM that you can create and destroy several times over as you work through the examples. This is especially true when we try executing DSC configurations remotely later in the chapter.

Test environments

There are several approaches you can take when building and using test environments. If you have the spare physical machines, you can set up several machines as test servers to run these configurations. This is the easiest way if you have the extra hardware lying around, but it becomes difficult when you want to treat them as disposable machines. Constantly reinstalling the machines will become tedious without imaging software, so keep in mind the time cost this entails if you go this route.

A far easier route is Virtual Machines (VM), which are commonplace is today's world. HyperV, VMware, and Parallels all have options to run VMs on your desktop or laptop. This allows you to have dependable and repeatable tests on known configurations so that you can keep testing your DSC configurations until you are sure they work.

While each of these vendors' software has the functionality to allow you to perform an operation and then "roll back" to a known good state, it is sometimes slow and cumbersome to use these features. They were designed with infrequent use in mind. We are looking for something that can be brought up in minutes just as easily as it can be destroyed. A good tool to look into using for this purpose is Vagrant (https://www.vagrantup.com/). Setting up and using Vagrant is beyond the scope of this book, but there are a good many resources out there to get you started. It will make your life a lot easier to use tools like Vagrant, VMware, or HyperV to automate your development environments.

For the purposes of this book, it is not necessary to have these setups specifically, but we will assume that you are at least using a test machine on which you can run these commands time and time again while you get used to these operations.

We are going to build two test computers and call them box1 and box2. We will use box1 both as the place where we make the DSC configuration and the place where we execute it from. The second test computer, box2, will be our target node that receives DSC configurations from us so that we can demonstrate remote operations. Because of this, both computers need to be able to access each other on the network, so configure your IP addresses appropriately.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset