Hello Martin,
Let's say we have three directories:
preproduction/ preproduction/ private/
There are different manifest files saved in the same name, like
service-deploy.pp.
In the manifest service-deploy.pp, I want to get the absolute path to
itself, then determine the variable of env like:
$dir = dirname($file) # $file is absolute path to service-deploy.pp
like: '/path/to/manifests/preproduction/service-deploy.pp'
$env = split($dir, '/')[-1]
Then, hiera dynamically maps the correspond yaml file under the $env like:
mapped_paths: [services, svc, "environments/%{env}/%{svc}.yaml"]
This is what I want to realise. I know puppet has already provided a
switch in response to $environment, e.g.,
/etc/puppetlabs/code/environments/production. In this way, I have to
maintain some branches in parallel. That is what I don't want to do.
Kind regards,
Go
> To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-users/2E04526A-7F74-4F84-99E4-4C1D675FC67C%40gmail.com.