Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- heat_template_version: 2017-02-24
- description: Template that installs Windows Server
- parameters:
- image:
- type: string
- label: Image name or ID
- description: Image to be used for server
- default: 'windows 2012r2 cloud'
- constraints:
- - allowed_values:
- - 'windows 2012r2 cloud'
- public_net:
- type: string
- description: >
- ID or name of public network for which floating IP addresses will be allocated
- windows_server_network:
- type: string
- description: Name of private network to be created
- windows_server_subnet:
- type: string
- description: Subnet details
- windows_server_hostname:
- type: string
- description: Server HOSTNAME
- resources:
- # Generate a random 16 Character Hex String
- random_volume_name:
- type: OS::Heat::RandomString
- properties:
- length: 16
- sequence: hexdigits
- windows_server_volume:
- type: OS::Cinder::Volume
- properties:
- name:
- list_join: ['-', [ {get_param: windows_server_hostname}, { get_resource: random_volume_name}]]
- image: { get_param: image }
- size: 45
- volume_type: unity_cap
- windows_server:
- type: OS::Nova::Server
- depends_on: windows_server_volume
- properties:
- name: { get_param: windows_server_hostname }
- image: { get_param: image }
- flavor: m1.medium
- block_device_mapping: [{ device_name: "vda", volume_id : { get_resource : windows_server_volume }, delete_on_termination : "true" }]
- key_name: 'windows-cloudinit'
- networks:
- - port: { get_resource: windows_server_port }
- user_data_format: RAW
- user_data:
- str_replace:
- template: |
- #ps1_sysnative
- $ComputerName = Hostname
- $DomainName = "param_domain_name"
- $OUPath = "param_ad_ou_path"
- $username = "$DomainName\param_user_name"
- $password = "param_user_password" | ConvertTo-SecureString -asPlainText -Force
- $Credential = New-Object System.Management.Automation.PSCredential($username,$password)
- # To force a restart, add "-Restart -Force" to the end of this command
- Add-Computer -ComputerName $ComputerName -DomainName $DomainName -Credential $Credential -LocalCredential $Credential #-OUPath $OUPath
- # Cloudbase-Init Exit codes:
- # 1001 - reboot and donβt run the plugin again on next boot
- # 1002 - donβt reboot now and run the plugin again on next boot
- # 1003 - reboot and run the plugin again on next boot
- exit 1001
- params:
- param_domain_name: mydomain.com
- param_user_name: domainusername
- param_user_password: domuserpassword
- param_ad_ou_path: "OU=testOU,DC=domain,DC=Domain,DC=com"
- windows_server_port:
- type: OS::Neutron::Port
- properties:
- network_id: { get_param: windows_server_network }
- fixed_ips:
- - subnet_id: { get_param: windows_server_subnet }
- windows_server_floating_ip:
- type: OS::Neutron::FloatingIP
- properties:
- floating_network: { get_param: public_net }
- port_id: { get_resource: windows_server_port }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement