Skip to content

Instantly share code, notes, and snippets.

@rgbkrk
Last active August 29, 2015 13:58
Show Gist options
  • Save rgbkrk/10014910 to your computer and use it in GitHub Desktop.
Save rgbkrk/10014910 to your computer and use it in GitHub Desktop.
Bootstrap a Windows box on Rackspace for DevOps Automation

Flavor: performance2-15 Image: 6110edfe-8589-4bb1-aa27-385f12242627

$ nova network-create "BuildNet" "192.168.4.0/24"
+----------+--------------------------------------+
| Property | Value                                |
+----------+--------------------------------------+
| cidr     | 192.168.4.0/24                       |
| id       | e22b534d-4835-43dd-9896-f5b3f6123569 |
| label    | BuildNet                             |
+----------+--------------------------------------+
$ nova boot controller.dfw --image 6110edfe-8589-4bb1-aa27-385f12242627 --flavor performance2-15 --nic net-id=e22b534d-4835-43dd-9896-f5b3f6123569 --key-name rgbkrk --poll
$ nova boot --image 240b8fb2-da7a-482a-9429-891b374cb57c --flavor performance2-15 --nic net-id=e22b534d-4835-43dd-9896-f5b3f6123569 --file "C:\\cloud-automation\\bootstrap.cmd=open_hatch.cmd" --no-service-net --no-public --poll windex

With pyrax (not complete)

files = {"C:\cloud-automation\bootstrap.cmd": content}
server = cs.servers.create("windex", winid, flavor_15GB.id, files=files)
REM Make sure to change <IP_ADDR> to the box you'll be connecting from
REM Comments will need to be removed to render this on the box (size requirement)
REM Start the Windows time service and sync it with time.dfw1.rackspace.com
net start w32time
w32tm /config /manualpeerlist:"time.dfw2.rackspace.com time.dfw1.rackspace.com" /syncfromflags:manual /reliable:yes /update
w32tm /resync
REM Allow connections from <IP_ADDR> on the winrm port
netsh advfirewall firewall set rule group="remote administration" new enable=yes & netsh advfirewall firewall add rule name="WinRM Port" dir=in action=allow protocol=TCP remoteip=<IP_ADDR> localport=5985
REM Add controller to the hosts file (set controller to your hostname)
echo <IP_ADDR> controller >> C:\Windows\system32\drivers\etc\hosts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment