Example virtual server creation (Windows OS) Heat template with computer name specification

Creating_a_virtual_server_for_WindowsOS.yaml

The following is an example template that specifies the computer name when creating a virtual server (Windows OS).

Indicate the computer name to specify in the following location in the template.

Note: Example: Rename-Computer -Force -NewName "computer_name_to_specify" -Restart
#
#
# This template specifies the computer name when creating a virtual server (Windows OS). 
#
#
heat_template_version: 2013-05-23

description: >
  This template specifies the computer name when creating a virtual server (Windows OS). 

parameters: 
  VOLUME_NAME:
    type: string
    description: Name of the system volume of the Virtual Server
    default: Sample_Volume_01

  VOLUME_SIZE:
    type: string
    description: Volume size of the system volume of the Virtual Server
    default: 80

  AZ:
    type: string
    description: Name of the Availability Zone to deploy the Virtual Server in
    default: jp-east-1a

  FLAVOR:
    type: string
    description: Name or ID of the Flavor type of the Virtual Server to create
    default: S-1

  IMAGE_ID:
    description: Image ID or image name to use for the Virtual Server
    default: 0e9e37b7-5514-4e9a-95d9-b6927a74e200

  KEY_NAME:
    type: string
    description: Name of the existing key pair used for the Virtual Server
    default: Sample_Key_01

  SERVER_NAME:
    type: string
    description: Name of the Virtual Server to create
    default: Sample_Server_01

  NETWORK_NAME:
    type: string
    description: NAME of the Network to deploy the Virtual Server on
    default: Sample_Network_01

  NETWORK_ID:
    type: string
    description: ID of the Network to deploy the Virtual Server on
    default: 6eft72d8-a4ad-4h4f-8d2d-76soe8ba122b

  SECURITY_GROUP_NAME:
    type: comma_delimited_list
    description: ID of the Security Group associated with the Virtual Server
    default: Sample_Security_Group_01


resources:
  VOLUME_01:
    type: OS::Cinder::Volume
    properties: 
      name: { get_param: VOLUME_NAME }
      size: { get_param: VOLUME_SIZE }
      volume_type: M1
      image : { get_param: IMAGE_ID }
      availability_zone: { get_param: AZ }

  SERVER_01:
    type: OS::Nova::Server
    properties:
      availability_zone: { get_param: AZ }
      block_device_mapping: [{"volume_size": { get_param: VOLUME_SIZE }, "volume_id": {get_resource: VOLUME_01 }, "delete_on_termination": True, "device_name": "/dev/vda" }]
      flavor: { get_param: FLAVOR }
      image: { get_param: IMAGE_ID }
      key_name: { get_param: KEY_NAME }
      name: { get_param: SERVER_NAME }
      networks: ["uuid": { get_param: NETWORK_ID }]
      security_groups: { get_param: SECURITY_GROUP_NAME }
      user_data_format: RAW
      user_data: |
        #ps1
        Rename-Computer -Force -NewName SampleNameWindowsV01 -Restart


outputs:
  SERVER_01_DETAIL:
    description: 
    value: { get_attr: [SERVER_01, show] }

  SERVER_01_NETWORK:
    description: 
    value: { get_attr: [SERVER_01, networks] }

  SERVER_01_IP:
    description: 
    value: { get_attr: [SERVER_01, addresses,{ get_param: NETWORK_NAME }, 0, port] }