How can I customize guest operating system


#1

There are no possibilities to customize the guest operating system after the deployment from the template.
We need a mechanism to perform additional guest customisation after first boot of VM. This would include:

  • installing files to an instance
  • executing commands on a VM post-boot

#2

What platform is this? VMware, RHEV, RHELOSP, AWS EC2 etc…?

There are many possibilities to customise an operating system delivered from a template, these include and not limited to…

* CLOUDinit
* Sysprep
* VMTools
* SSH
* Puppet/Chef/SCCM/RADIA etc....
* RunOnce
* etc..

thanks


#3

Hi jhardy, thank you for reply. I’m using vCenter and RHEV.
I’m evaluation a number of solutions for the deployment of cloud, most of which have built-in functionality for customization of virtual machines (REST API ?). Network configuration of templates to be deployed does not up quickly, templates can have network interfaces on an isolated network (Conteiners of VM with firewall as access point).
vCloud has the ability to run arbitrary bash script during deployment of VM. (This is the best option.)
Cisco UCS Director uses a policy for this purpose.
Any external services or SSH command - is not the solution.


#4

For RHEV I am not able to do any customization of the template.


#5

Sure, so we support most of the options that any of the providers make available.

So example,
AWS EC2 uses mostly CLOUDinit for post customisation, if you go into the Infrastructure/PXE menu in ManageIQ you can create customisation specifications that are CLOUDinit syntax and use them when you instantiate AWS EC2 aim’s. The CLOUDinit customisation specification template you create will be available for selection when you provision EC2 aim’s.

This process is similar for the other platforms, so

VMware = Customisation Specification (applied by vmware using vmtools when linux and sysprep when windows)
RHEV = Since RHEV 3.3 I believe that CLOUDinit can be used.

Depending on what you are trying to achieve and the guest os platform you can always just run some custom workflow at the end of the provisioning state machine to attach to the guest and do something, example;

Deploy RHEL server, when ManageIQ reports it has an IP address for the deployed guest, use the IP and SSH to the box and run some puppet configs.

If no network is available then you are down to APIs of the vendor platform, this means

VMware = vmtools VIX api.
RHEV = rhevm tools.

Your research in this area really needs to be targeted at the virtualization platform provider, they own the API calls between orchestration and guest. ManageIQ will manage these calls and provide all the inputs and gather the returns for the orchestration.

Hope this helps.


#6

Hi all,

Thanks for this thread. Using cloud-init is simple enough in CloudForms (and presumably ManageIQ) via the menu Compute -> Infrastructure -> PXE . I’ve managed to configure a CentOS host just fine.

That said, for the life of me I can’t find a minimal demonstration for Windows hosts. I’d like something that can go as far back as Windows Server 2008 (e.g. cloudbase-init).

Does anyone have some example they can offer?


#7

I was able to customize a Windows and CentOS hosts on AWS after all. Below are the steps for Windows.

To begin, navigate to “Compute” -> “Infrastructure” -> “PXE”. Expand the “Customization Templates” on the left. In the “Configuration” menu, select “Add new Customization Template” , and provide the criteria, for instance :

  • Name: user-data.xml
  • Description: My customization template
  • Image Type: Windows
  • Type: CloudInit

The steps above are the same in CentOS, except you’ll select Image Type: CentOS . You’ll still choose “CloudInit”.

Inside the script text area, enter the code you’d like to run, for instance this:

<powershell>
  Write-Host "This script is running in PowerShell `n"
  Write-Host "The current PowerShell version is `n $PSVersionTable.PSVersion `n"
  pwd > c:\test.log
  dir >> c:\test.log
</powershell>

The code obviously has to work on the image you’re working with and relies on Amazon’s “user-data” feature: https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ec2-instance-metadata.html#user-data-execution.

Once you’ve created this script, navigate to “Compute” -> “Clouds” -> “Instances”. Select “Lifecycle” -> “Provision Instance”.
2. Select a Windows image (AMI) and click "Continue"
3. Enter request criteria:

a) On the first tab (named “Request”), enter Email, First Name, and Last Name
b) On the Catalog tab, enter an Instance Name (e.g. “windows-test”)
c) On the Environment tab, check the box under Placement -> "Choose Automatically"
d) On the Properties tab, select “Instance Type” -> “t2.medium” and “Guest Access Key Pair” -> (my keypair)
e) On the Customize tab, only Customization templates with type “CloudInit” are displayed. Select the script you’ve just created.

Submit the request, you should observe that the customization script will run. Syntax is different in *nix machines (RHEL / CentOS). For instance, use a CloudInit script like this : https://gist.github.com/b-long/22d7d0216c84ac178e13702aac389002