Performance Checklist
In this lab, you will create templates and use them to deploy virtual machines.
Outcome
You should be able to create a template and deploy a virtual machine.
Log in to workstation as student using student as the password.
On workstation, run the lab vms-review start command.
This command runs a start script that determines if the Red Hat Virtualization environment is configured and working.
Wait for the start script to finish before starting the lab.
The start script creates a new virtual machine named rhel-vm1, which does not initially exist in the production data center.
[student@workstation ~]$lab vms-review start
The start script created the rhel-vm1 virtual machine in the production data center.
Install cloud-init on the rhel-vm1 virtual machine in the production data center.
Open Firefox and, using the https://rhvm.lab.example.com URL, log in to the Administration Portal as the admin user, with the internal profile, using redhat as the password.
Navigate to Virtual Machines by clicking on in the menu bar and then selecting .
Highlight the row containing the rhel-vm1 virtual machine in the clustertwo cluster by clicking on an empty cell in that row.
Ensure that the rhel-vm1 virtual machine is running. If it is not, click the button to start it.
When available, open the console and log in to rhel-vm1 as user root with redhat as the password.
To install the cloud-init software package on your rhel-vm1 virtual machine, you normally would ensure the system is registered with Red Hat Subscription Manager and has the correct entitlements and Yum repositories enabled.
In this classroom environment, this step has been modified because the classroom might not have access to the Content Distribution Network or a Red Hat Satellite server. Instead, local Yum repositories have been provided that contain the correct packages.
Install the cloud-init package with all dependencies using the yum command.
[root@rhel-vm1 ~]#yum -y install cloud-init...output omitted...
Shut down the rhel-vm1 virtual machine using the systemctl poweroff command.
[root@rhel-vm1 ~]#systemctl poweroff
Create a new template named cloud-lab-template in the production data center, using the rhel-vm1 virtual machine.
Give the template a description of cloud-init based template, and give the template disk an alias of rhel7-cloud-lab.
Ensure that the row containing the rhel-vm1 virtual machine in the clustertwo cluster is highlighted by clicking an empty cell in that row.
With the rhel-vm1 virtual machine row highlighted, click the three vertical dots to the right of the button, and then select .
Specify all the settings needed to create the template using the New Template window.
In the Name text field, type cloud-lab-template as the template name.
In the Description text field, type cloud-init based template as the template description.
In the Alias text field, type rhel7-cloud-lab as the template alias.
If it is not already selected, then select the Seal Template (Linux only) check box.
Leave all other options as they are.
Click the button to begin the template creation. This step can take a couple of minutes to finish. When the process of creating the template is complete, the virtual machine is released from its locked state.
Ensure that virtual machines created from the cloud-lab-template template will use cloud-init.
On the Compute >> Templates page, click an empty cell in the row containing cloud-lab-template.
With the row containing cloud-lab-template highlighted, click the button.
The Edit Template window displays.
In the Edit Template window, click the button to access the advanced options. Click the Initial Run tab.
Make sure the check box for Use Cloud-Init/Sysprep is selected.
Make sure the VM Hostname text field is empty.
Leave the other options with their default values. Click the button to accept the changes.
Use the cloud-lab-template template to deploy a new virtual machine called rhel-lab-vm to the production data center.
Configure cloud-init to:
Make sure that the new virtual machine has the correct host name (rhel-lab-vm).
Configure the /etc/motd file to display the message: This VM has been provisioned using cloud-init.
Create a new user called labuser with redhat as the password.
On the Compute >> Virtual Machines page, click the button. The New Virtual Machine window displays.
In the Cluster menu, choose .
In the Template menu, choose .
In the Name field, type rhel-lab-vm as the virtual machine name.
In the Description field, type RHEL Guest for cloud-init lab as the virtual machine description.
Leave all the other options as they are and click the button to create the new template-based virtual machine.
Wait while the virtual machine is created.
After the rhel-lab-vm virtual machine becomes ready to use, highlight the row containing the virtual machine by clicking an empty cell in that row.
With the row containing rhel-lab-vm highlighted, click the drop-down menu and select Run Once to display the Run Virtual Machine(s) window.
Click the + icon next to Initial Run.
Make sure that the check box on the Use Cloud-init line is selected.
In the VM Hostname text field, ensure that the rhel-lab-vm name is present.
This will change the host name of the new virtual machine.
Click Authentication to reveal the Authentication section.
Enter a User Name of labuser, and a Password of redhat.
Enter the password again in the Verify Password field.
In the Custom Script text area, enter the following lines:
write_files:
- path: /etc/motd
content: |
This VM has been provisioned using cloud-init.
YAML used by cloud-init is sensitive to white space indentation. Indent your script as shown in the example for this step, using two spaces for each indentation level. The blank line at the end (with one or more spaces) ensures a new line character is added to the end of the file.
Click to initiate the creation of the virtual machine, using cloud-init as the provisioning method.
Once the new virtual machine is ready, log in to the rhel-lab-vm virtual machine as labuser to ensure that all the changes were successfully applied by cloud-init.
Once the virtual machine is running, click the button and verify the changes made by cloud-init.
Log in as the labuser user with redhat as the password.
Notice that the host name of the virtual machine is rhel-lab-vm.
The message displayed after you log in matches that which cloud-init placed into the /etc/motd file.
When you have finished reviewing the changes to the rhel-lab-vm virtual machine, close the virtual machine console.