Hi
I have the hiera_yamlgpg backend up and running working like a charm with the following configuration:
:yamlgpg:
:datadir: "/etc/puppet/environments/%{::environment}/hieradata"
:key_dir: "/etc/puppet/keys" # optional, defaults to ~/.gnupg
:fail_on_error: true # optional, defaults to false
By business requirements I have been asked to use one or another private key depending a custom fact. So my hiera.yaml configuration file looks like this:
:yamlgpg:
:datadir: "/etc/puppet/environments/%{::environment}/hieradata"
:key_dir: "/etc/puppet/keys/%{::custom_fact}" # optional, defaults to ~/.gnupg
:fail_on_error: true # optional, defaults to false
The problem I am facing is that hiera is not interpolating the %{::custom_fact} on the :key_dir: line. The error I get is:
WARN: Tue Apr 07 15:41:17 +0200 2015: No usable keys found in /etc/puppet/keys/%{::custom_fact}/. Check :key_dir value in hiera.yaml is correct
/etc/puppet/environments/production/modules/hiera_yamlgpg/lib/hiera/backend/yamlgpg_backend.rb:102:in `decrypt_ciphertext': No usable keys found in /etc/puppet/keys/%{::custom_fact}/. Check :key_dir value in hiera.yaml is correct (Hiera::Backend::YamlgpgError)
Puppetlabs' documentation [1] says " You can also interpolate variables into other settings, such as :datadir (in the YAML and JSON backends):" which makes sense with the behavior I am getting (Sadly, it doesn't says anything about other variables :():
* The %{::environment} variable on :datadir: line is interpolated
* But %{::custom_fact} on :key_dir: is not.
Any Idea how to workaround this?
[1]
http://docs.puppetlabs.com/hiera/1/variables.html#in-other-settingsThank you for your time
Best regards
--------------------------------------------------------------------------------------
Juan Sierra Pons
ju...@elsotanillo.netLinux User Registered: #257202
Web:
http://www.elsotanillo.net Git:
http://www.github.com/juasiepoGPG key = 0xA110F4FE
Key Fingerprint = DF53 7415 0936 244E 9B00 6E66 E934 3406 A110 F4FE
--------------------------------------------------------------------------------------