Code Monkey home page Code Monkey logo

Comments (5)

sihil avatar sihil commented on August 16, 2024

Hi @kbrede,

A few questions that will help to give a little more context to your issue:

  • what does the rest of your hiera.yaml look like?
  • how are you running puppet - is that on a real host?

To help you troubleshoot I recommend testing hiera directly without puppet. You can do that using the hiera command line tool. Without the rest of your hiera.yaml config file I can't tell exactly what command you'll need to run, but something like hiera -c /path/to/hiera.yaml test hostname=hostname should do the trick (you can specify 'fact' key value pairs you need to provide at the end of the command).

Regards,
Simon

from hiera-eyaml.

kbrede avatar kbrede commented on August 16, 2024

Thanks for your help Simon. I'm getting closer.

After adding:

:backends:
  -eyaml

Commenting out:

:extension: 'yaml'

Changing:

 /etc/puppet/hieradata/hosts/puppet.yaml
to /etc/puppet/hieradata/hosts/puppet.eyaml

And changing:

"hosts/%{::hostname}"
to "hosts/%{hostname}"

I can now pull back the encrypted string unencrypted with:

hiera -c /etc/puppet/hiera.yaml test_val hostname=puppet

But Puppet is not able to unencrypt the string. It still shows up in the file as:

ENC[PR............VggBD652vwNiSvudBq6wuyHRpn]

My current hiera.yaml file is posted below. I'm running puppet as "puppet agent -t" and "puppet" is a real host. -- Thanks.

hiera.yaml

:backends:
  - yaml
  - eyaml
:yaml:
  :datadir: /etc/puppet/hieradata
:eyaml:
  :datadir: /etc/puppet/hieradata
  #:extension: 'yaml'
  :pkcs7_private_key: /etc/puppet/secure/keys/private_key.pkcs7.pem
  :pkcs7_public_key:  /etc/puppet/secure/keys/public_key.pkcs7.pem

:hierarchy:
  - "%{virtual}"
  - "%{architecture}"
  - "%{operatingsystemmajrelease}"
  - "hosts/%{hostname}"
  - common
  - global

from hiera-eyaml.

sihil avatar sihil commented on August 16, 2024

Good to hear you're getting there.

So first of all, I'd be tempted to temporarily remove the 'yaml' backend to make sure you are not inadvertently retrieving an encrypted value through the default backend. I tend to put eyaml first in backend list so I hit that first and fall back to normal yaml files second.

Sounds like it is picking up the right file, as you are getting something back rather than an error. That implies the hostname fact is correct - but maybe check that hostname is what you expect on the box you are running puppet apply on using the facter -p command.

Other than this is looks like it should work - the keys are clearly correct if the hiera command is working. Perhaps try running puppet in debug mode and see if that gives any clues.

Are you using a simple puppet manifest (one that just writes a file or similar)? If so can you post that for completeness?

from hiera-eyaml.

kbrede avatar kbrede commented on August 16, 2024

Solved! All I had to do is put the 'eyaml' backend above 'yaml' as you suggested.

Once I did that I was also able to add back:

:extension: 'yaml'

Yep, I was just using a simple file type, for testing:

file { '/tmp/test.txt':
  ensure  => present,
  content => $test_val,
}

Thanks for your help!
Kent

from hiera-eyaml.

sihil avatar sihil commented on August 16, 2024

Great :)

You're welcome - I'm going to close this issue. Good luck rolling it out.

from hiera-eyaml.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.