Foreman support for the Vmware tags

Hello,

We use in our company Foreman (ver 1.15 currently) for provisioning VM in the Vmware Compute Resource. In our previous solution we were using Vmware tags (https://pubs.vmware.com/vsphere-51/index.jsp?topic=%2Fcom.vmware.vsphere.vcenterhost.doc%2FGUID-E8E854DD-AA97-4E0C-8419-CE84F93C4058.html) for passing some important information for us (e.g. owner of the machine or the backup priority). I can’t see this functionality in Foreman (at least there is no in UI) and I was just wondering if it is possible to pass such an information to Vmware in this or other way?

From what I was able to see, by default Foreman uses the tag for example for the “data store” (taken from the Compute Profile).
My question is, how is the Foreman is adding this tag, what method is it using, so we can reuse it in our provisioning scenarios.

Thanks for help!

Hi,

we currently don’t support this, but we wanted to look into adding support for this.
As far as I know, this is just supported in recent vSphere versions. What version are you currently running?

Timo

Hello Timo,

I am afraid it is not the newest one unfortunately - v. 6.0.

From what I know till know we were using Powershell scripts to add those tags during the provisioning process.

Regards!

Do you mind sharing the relevant bits? E.g. how the tags are added?

Would you want Foreman to automatically set tags or just define a bunch of them manually?

Hello Timo,

Below you can find the piece of code from the Powershell script with some description.

First of all we add the Tags to a Dropdown menu (using the Powercli for the VCenter)

$strBackup = Get-Tag -Category “NetBackup” | Select-Object Name | findstr backup-data
$strBackup | % {
$objBackup.Items.Add($_.trim())
} | Out-Null

This we repeat for all necessary Tags (and write them into Variables)

After we deployed the VM we use

$VM | New-TagAssignment -Tag $BackupTag

To add the tag to the VM

There are also other fields we populate using the Powercli (e.g.: Description field)

$VM | Set-VM -Description $DOCUNOTES -Confirm:$false

Below an example of the few tags:

Name Category Description


AUTO_STARTSTOP_PRIO:0 AUTOMATION Start/Stop Prio 0: NO Start/Stop
AUTO_STARTSTOP_PRIO:1 AUTOMATION Start/Stop Prio 1: for basic Infrastructure like DCs, …
backup-data-class:medium Netbackup weekly backup
BU_NOBU BusinessUnit Set here company’s BU for Reporting

Not sure how I would like it to be implemented, maybe it would be nice if there was some field in which you can input the name/category/description when using Vmware as the Compute Resource.

Thanks and regards !

Hello,

Any chances to have this implemented some time in the future or not really?

Is there anything else I can provide to help?

Thanks!

I want to be honest with you: Not in the near future.
What definitely helps is an issue / feature request in Redmine.

As a workaround, you might be able to use Foreman Hooks to accomplish something similar to what you have been using before.

Hello Timo,

Sorry for late reply but I have never been using the Foreman Hooks before and I am not sure how they are working.

You think it would be possible to use the Powershell scripts during the provisioning process? If yes, can you share with me some more information how would it look like? I will be grateful for any hint :slight_smile:

Thanks in advance !!!

I haven’t used foreman_hooks myself yet, so can’t share any insights. Sorry.