Hi, I have a complex use case which I hope would be possible to implement with Director.
I am trying to automatically populate host groups based on our naming convention.
I am using vspheredb to import all virtual machines and vm hosts. They all follow the same naming convention. The first 3 characters identify the location of an asset. We may as well work with IP ranges later, but this is where we are.
For instance, a host resource with the name ‘fraxxxxxxxx’ should be assigned to the host group ‘Frankfurt’.
For this, I have setup an import source which consists of a simple query.
select ‘1’ as ‘key’, ‘fra’ as ‘identifier’, ‘Frankfurt’ as ‘location’ union all select ‘2’ as ‘key’, … (and so on and so fourth)
The idea is that I will use modifiers for my vspheredb import, have a field with substring(0,3) and match this against the lookup table for ‘identifier’, then take what is in ‘location’ for my asset.
I don’t think I can use a modifier and the lookup table in the filter expression.
So far I have a modifier like this:
property: object_name
target property: locationidentifier
Modifier: substring
Start: 0
End: 3
This gives me a column with ‘fra’ as locationidentifier
My second modifier is this:
Property: locationidentifier
Target property: location
Set based on filter: yes
Filter Expression: locationidentifier=identifier
Modifier: Get a property from another Import Source
Import Source: location_mapping
Property: location
Unfortunately the location is always empty and I have no idea how to construct the filter to use the value instead of text…