VMware Cloud Community
_MikeW_
Enthusiast
Enthusiast

vRO 8.1 Workflow, creating text file to persist on guest os during provisioning

I am trying to figure out how to programmatically create a text file on a guest os (provisioned vm) with specific data to that build. A simple example (tho not for my use case) would be..

file: /etc/motd

with contents of : "VM created on " + date();

Can someone point me in the right direction? All I've been able to find so far is how to copy files from vRO->guest (static files) but thats not what im looking for. I would like to create the file (dependent on OS) during provisioning with specific content.

Tags (1)
4 Replies
_MikeW_
Enthusiast
Enthusiast

I'm guessing from the lack of response that I must be going at this the wrong way? Is there no way to programmatically do what I am suggesting through Workflows? Can you not talk directly to a VM during provisioning and do such a thing?

I expect there is a way to do this as our Professional Services team did something along these lines within the scope of their workflows. We're wanting to use similar methods for other purposes. Unfortunately their code is a bit... "unreadable" and trying to resolve how they were able to talk to the guest OS and create files is a bit of a problem.

I had expected there was a standard procedure for this but ... maybe I was mistaken.

Reply
0 Kudos
siglert
Enthusiast
Enthusiast

Create a text file as a resource element that will accept variable.  Get the resource element in the workflow pass in the variables to change the wording the use the write file to guest OS VRO workflow.

Reply
0 Kudos
Lalegre
Virtuoso
Virtuoso

You can do that using cloud-init for Linux VMs which allows you to run scripts inside the VM. Same as you use to do in vRA 7.x with the Guest Agent and Software Components.

Please take a look at these:

          Configuration commands in vRealize Automation Cloud Assembly blueprints

          Customizing Cloud Assembly Deployments with Cloud-Init - VMware Cloud Management

With the runcmd parameter mentioned you can actually run commands inside the VM.

Reply
0 Kudos
_MikeW_
Enthusiast
Enthusiast

We actually do use cloud-init already for the resizefs feature (system disks). However the method I am trying to implement the dynamic data file is not something I can stuff into a cloud init config file.

The plan is to determine the method to create dynamic files on the provisioned system during provisioning and day 2.

I've been doing some research and it seems the method professional services (vmware) uses is to create the file locally on the vro server, push the file to the remote and then run that file if it's a script. I'm not entirely sure how to achieve the latter just yet but will continue to try and sort it out.