Open gaelcolas opened 6 years ago
Would this mean that if we enter something like:
Domain: Cosonto
then in a further yml file we would be able to reference it directly, like:
SqlInstallCredential: #{Domain}\theusername
We were looking on how we could do exactly that. So I take it it's not possible right now but eventually coming?
That's the principle, yes. Not built-in yet.
But you could do something similar by creating a Datum handler as explained here: https://github.com/gaelcolas/Datum/blob/master/docs/Datum_Redirections.md
Yup, tried the handler, and it works great when there is only one variable to get, and the full path to get it is static, but I wasn't able to make it work when there are also a variable in the path to follow to get the variable. I think it's what you described as a nested lookup in your document.
I'll try to describe our setup to demonstrate the problem.
Our folder structure is like this
+--+AllNodes
| +V4Unit
| | +SQLSERV01.yml
| |
| +V5Unit
|
+--+Paliers
| +V4Unit.yml
| |
| +V5Unit.yml
|
+--+Roles
| +PortailSQL.yml
First, I create SQLSERVR01.yml which goes under Allnodes/V4Unit (pardon the french in the labels :) )
NodeName: SQLSERV01
Environnement: Unitaire
Volet: V4
Palier: V4Unit
Role: PortailSQL
Description: SQL pour Portail
Then it's in in PortailSQL.yml that I encounter the problem of a nested lookup
Configurations:
-BASE_INSTALL_SQL
BASE_INSTALL_SQL:
- Name:
<bunch of other variables>
SqlInstallCredential: '[VAR=Paliers\$Palier\Domaine]\SrvSqlInstall' #should be in the $Domain\username format
So, here, I need to get the Domain
value which can be found in the yml file under the folder Paliers and in the yml file corresponding to the $Palier variable defined in the SQLSERV01.yml file. But I can't find how I'm supposed to be able to get it's value. Hence my research through the issues here.
It looks like the feature described in this ticket would indeed solve that problem nicely.
Anyone looked into this lately? I just started using datum, and found that I have a need to concatenate data from different layers into one final string. Example: Role mssql yaml contains the config parameter for a user to add to local admins. But I want to fetch the domain part of the name from the environment yaml file. Is there a way to do this?
Similar to Redirections, it would be useful to use variable interpolation in Datum similar to Hiera:
'#{user}@#{domain}'
That would do a lookup for User and a lookup for Domain, and then aggregates them.