SHARE
TWEET

windows-server-multipart.yaml

dev-rowbot Jun 7th, 2017 141 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. heat_template_version: 2017-02-24
  2.  
  3. description: Template that installs Windows Server
  4.  
  5. parameters:
  6.   image:
  7.     type: string
  8.     label: Image name or ID
  9.     description: Image to be used for server
  10.     default: 'windows 2012r2 cloud'
  11.     constraints:
  12.       - allowed_values:
  13.        - 'windows 2012r2 cloud'
  14.   public_net:
  15.     type: string
  16.     description: >
  17.      ID or name of public network for which floating IP addresses will be allocated
  18.   windows_server_network:
  19.     type: string
  20.     description: Name of private network to be created
  21.   windows_server_subnet:
  22.     type: string
  23.     description: Subnet details
  24.   windows_server_hostname:
  25.     type: string
  26.     description: Server HOSTNAME
  27.  
  28. resources:
  29.   key_winrm_cloudinit_cert:
  30.     type: OS::Heat::SoftwareConfig
  31.     properties:
  32.       group: ungrouped
  33.       config: { get_file: ../keys/cloudbase-init-cert.pem }
  34.  
  35.   script_add_host_to_domain:
  36.     type: OS::Heat::SoftwareConfig
  37.     properties:
  38.       group: ungrouped
  39.       config:
  40.         str_replace:
  41.           template: { get_file: ../scripts/add-host-to-domain.ps1 }
  42.           params:
  43.             param_domain_name: mydomain.com
  44.             param_user_name: domainusername
  45.             param_user_password: domuserpassword
  46.             param_ad_ou_path: "OU=testOU,DC=domain,DC=Domain,DC=com"
  47.  
  48.   windows_server_init:
  49.     type: OS::Heat::MultipartMime
  50.     properties:
  51.       parts:
  52.        [
  53.           {
  54.             filename: "cloudbase-init-cert.pem",
  55.             subtype: "x-cfninitdata",
  56.             config: { get_resource: key_winrm_cloudinit_cert }
  57.           },
  58.           {
  59.             filename: "add-host-to-domain.ps1",
  60.             subtype: "x-shellscript",
  61.             config: { get_resource: script_add_host_to_domain }
  62.           }
  63.         ]
  64.  
  65.   # Generate a random 16 Character Hex String
  66.   random_volume_name:
  67.     type: OS::Heat::RandomString
  68.     properties:
  69.       length: 16
  70.       sequence: hexdigits
  71.  
  72.   windows_server_volume:
  73.     type: OS::Cinder::Volume
  74.     properties:
  75.       name:
  76.         list_join: ['-', [ {get_param: windows_server_hostname}, { get_resource: random_volume_name}]]
  77.       image: { get_param: image }
  78.       size: 45
  79.       volume_type: unity_cap
  80.  
  81.   windows_server:
  82.     type: OS::Nova::Server
  83.     depends_on: windows_server_volume
  84.     properties:
  85.       name: { get_param: windows_server_hostname }
  86.       image: { get_param: image }
  87.       flavor: m1.medium
  88.       block_device_mapping: [{ device_name: "vda", volume_id : { get_resource : windows_server_volume }, delete_on_termination : "true" }]
  89.       key_name: 'windows-cloudinit'
  90.       networks:
  91.         - port: { get_resource: windows_server_port }
  92.       user_data_format: RAW
  93.       user_data: { get_resource: windows_server_init}
  94.  
  95.   windows_server_port:
  96.     type: OS::Neutron::Port
  97.     properties:
  98.       network_id: { get_param: windows_server_network }
  99.       fixed_ips:
  100.         - subnet_id: { get_param: windows_server_subnet }
  101.  
  102.   windows_server_floating_ip:
  103.     type: OS::Neutron::FloatingIP
  104.     properties:
  105.       floating_network: { get_param: public_net }
  106.       port_id: { get_resource: windows_server_port }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top