![VMware vSphere 5.1 Cookbook](https://wfqqreader-1252317822.image.myqcloud.com/cover/964/36705964/b_36705964.jpg)
Creating a deploy rule
A deploy rule is created to deploy a chosen ESXi Image onto a server or group of servers chosen based on a supported pattern. Without a deploy rule, Auto Deploy server will not be able to associate an ESXi Image with a server to boot.
The pattern used to choose a server for deploying ESXi uniquely identifies the machine or a group of machines. The pattern can be an IPv4 address range, a MAC address, hardware vendor name, Asset tag, domain name, server model, serial number, and so on.
How to do it…
The following procedure will help you create a new deploy rule.
To create a new deploy rule issue the following command:
New-DeployRule -Name "RuleIP-21-25" -Item $imageprofile[1], "Cluster-21-25" -pattern "ipv4=192.168.193.21-192.168.193.25"
![](https://epubservercos.yuewen.com/8271C5/19470464208254306/epubprivate/OEBPS/Images/4026_03_34.jpg?sign=1738906538-LX22oLBMJS0p9SC56RxGQHkwIy3ja0xq-0-a56aa23094a5a1312e2c297454ea7516)
Here, RuleIP-21-25
is the name of the deploy rule; $imageprofie[1]
is ESXi-5.0.0-20111104001-standard; Cluster-21-25
is the name of the cluster at the vCenter Server; pattern ipv4=192.168.193.21-192.168.193.25
is the IP scope we created at the DHCP server, for the subnet to which the ESXi servers will be connected.
We could also attach a Host Profile to the ESXi server being deployed, when we create a rule.
Here is the command:
New-DeployRule -Name New-01 -Item $img[1],"Cluster-21-25", "For-21-25" –Pattern "ipv4=192.168.193.21-192.168.193.24"
![](https://epubservercos.yuewen.com/8271C5/19470464208254306/epubprivate/OEBPS/Images/4026_03_35.jpg?sign=1738906538-9Iy1laLYzLuyHZwz5ro9Bx1zzIkmx1zc-0-b4f950a0d526935a222f67d1fd908282)
Here, For-21-25
is the name of the Host Profile. Host Profiles are used to apply configuration templates to an ESXi server.
How it works…
When the command to create a new deploy rule is executed, it starts uploading the VIBs (vSphere Installation Bundles) in the image onto the Auto Deploy's cache
folder.
The cache
folder location is as follows:
C:\ProgramData\VMware\VMware vSphere Auto Deploy\Data\cache
The following screenshot shows the Auto Deploy's cache
folder:
![](https://epubservercos.yuewen.com/8271C5/19470464208254306/epubprivate/OEBPS/Images/4026_03_36.jpg?sign=1738906538-q74m10HEhbOMzWWMnA4Ac4DEeVCCg4GL-0-dcd58b0e2e6def7658c91572b94b4b0c)
Once it is done with the uploading of VIBs, it will finish and summarize the operations.
![](https://epubservercos.yuewen.com/8271C5/19470464208254306/epubprivate/OEBPS/Images/4026_03_37.jpg?sign=1738906538-xBWXyUW5nMtqxZZzlp2dudJmxgkYoyyn-0-770ddacc743cc9006711a4a881a778a3)