Automating VM creation: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
Line 1: Line 1:
{{To Do| finish writing up these sections and add more setup files and test/streamline setup files.}}
{{To Do| finish writing up these sections and add more setup files and test/streamline setup files.}}
The below virtual machine (VM) setup files are intended to be used to quickly create VMs and clusters of VMs. The files come in two forms, [https://wiki.openstack.org/wiki/Heat Heat] templates, and [https://cloudinit.readthedocs.io/en/latest/ CloudInit] files; both use the [https://en.wikipedia.org/wiki/YAML YAML] file format. CloudInit files are used to initialize a particular VM and run within that VM. They can be used to update the operating system, install and configuring applications, create files, run commands, and create users and groups. Heat templates are even more powerful. They can create multiple VMs at once, configure security groups to access VMs from the outside world, create and configure networks, create and attach volumes to VMs, and pass information to VMs about the network topology. They can also be used in conjunction with CloudInit files.
The below virtual machine (VM) setup files are intended to be used to quickly create VMs and clusters of VMs. The files come in two forms, [https://wiki.openstack.org/wiki/Heat Heat] templates, and [https://cloudinit.readthedocs.io/en/latest/ CloudInit] files; both use the [https://en.wikipedia.org/wiki/YAML YAML] file format. CloudInit files are used to initialize a particular VM and run within that VM. They can be used to update the operating system, install and configuring applications, create files, run commands, and create users and groups. Heat templates are even more powerful. They can create multiple VMs at once, configure security groups to access VMs from the outside world, create and configure networks, create and attach volumes to VMs, and pass information about other resources to CloudInit (e.g. floating IPs). They can also be used in conjunction with CloudInit files.


==Using CloudInit YAML Files==
==Using CloudInit==
The creation of CloudInit files is not covered here, see instead the official CloudInit documentation. When you are creating a new VM a CloudInit file can be used to describe how the VM is to be setup beyond the selected image. CloudInit files can be used with the Horizon dashboard (web GUI), the CLI, or the Python API. Here we describe how to use a CloudIinit file with Horizon.
The creation of CloudInit YAML files is not covered here, see instead the official CloudInit documentation. When you are creating a new VM a CloudInit file can be used to describe how the VM is to be setup beyond the selected image. CloudInit files can be used with the Horizon dashboard (OpenStack's web GUI), the CLI, or the Python API. Here we describe how to use a CloudIinit file with Horizon.


* Begin by clicking [[File:Launch-Instance-Button.png]] as described in [[Cloud_Quick_Start#Launching_a_VM]].
===Specifying a CloudInit File===
* '''Before''' clicking ''Launch'', select the ''Post-Creation'' tab. Then specify your ''Customization Script Source'', in this case a CloudInit YAML file, by either coping and pasting into a text box (Direct Input) or uploading from a file from your desktop computer (File). Note that older versions of OpenStack, in particular IceHouse, only provided a text box to copy and past your CloudInit file into.
* Start as normal when launching an instance, by clicking [[File:Launch-Instance-Button-Kilo.png|150px]] and specifying your VMs configuration as described in [[Cloud_Quick_Start#Launching_a_VM]].
*
* '''Before''' clicking ''Launch'', select the ''Post-Creation'' tab.
* Specify your ''Customization Script Source'', in this case a CloudInit YAML file, by either coping and pasting into a text box (''Direct Input'' method) or uploading from a file from your desktop computer (''File'' method). Note that older versions of OpenStack, in particular IceHouse, only provides a text box to copy and past your CloudInit file into.
* Once you have completed the usual selections for your VM as described in [[Cloud_Quick_Start#Launching_a_VM]] and provided your CloudInit YAML file to Horizon, click ''Launch'' to create the VM.
* It may take some time for CloudInit to complete running depending on what has been specified in the CloudInit YAML file.
 
===Checking CloudInit Progress===
To see the progress of CloudInit on your VM, check the console log of your VM do this by
 
* Selecting ''Project'' -> ''Compute'' -> ''Instances'' in the left hand menu.
* Click on the ''Instance Name'' of the VM. This will provide more information about the particular VM
* Select the ''Log'' tab and look for lines containing 'clout-init' for information about the various phases of CloudInit.
* When CloudInit is finished running you will see a like such as:
 
  Cloud-init v. 0.7.5 finished at Wed, 22 Jun 2016 17:52:29 +0000. Datasource DataSourceOpenStack [net,ver=2].  Up 44.33 seconds


==Using Heat Templates==
==Using Heat Templates==
cc_staff
1,486

edits

Navigation menu