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
On Mon, Aug 16, 2021 at 7:53 PM Martin Alfke <[email protected]> wrote:
>
> Hi Go,
>
> what do you want to achieve?
> When using puppet apply, a manifest can be anywhere on the filesystem.
>
> Best,
> Martin
>
>
> > On 16. Aug 2021, at 03:18, Go Iwai <[email protected]> wrote:
> >
> > Hello,
> >
> > I want to know the location where puppet-apply locally applied the
> > manifest file.
> >
> > $ pwd
> > /path/to/manifests
> > $ puppet apply file.pp
> >
> > In this case above, can I anyhow get the location of
> > /path/to/manifests/file.pp within file.pp?
> >
> > Kind regards,
> > Go
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Puppet Users" group.
> > To unsubscribe from this group and stop receiving emails from it, send an
> > email to [email protected].
> > To view this discussion on the web visit
> > https://groups.google.com/d/msgid/puppet-users/CAAyfkv-2dC--QR_1tz1ux%2BrgYaVsqjseB4oTEZ-EnkZPNXnn1w%40mail.gmail.com.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/puppet-users/2E04526A-7F74-4F84-99E4-4C1D675FC67C%40gmail.com.
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-users/CAAyfkv_qCcfWG5tcqkD%2BTAaSRPhr%3DsfCYYUP3q1MXToULxXyJw%40mail.gmail.com.