Hot answers tagged

6 votes

How to reference a hiera variable from elsewhere the hierarchy?

For Hiera 5, used in Puppet 5, use the following syntax: server_name: "service-%{lookup('env_name')}.%{::domain}" ...where %{lookup('env_name')} is the part that gets the data from other hiera key. ...
Greg Dubicki's user avatar
  • 1,309
5 votes
Accepted

What is the equivalent of using hiera as an ENC in Ansible?

Ansible supports pulling host and group variables from one or more external inventory systems. Examples are included of pulling in inventory from Cobbler, EC2 and OpenStack. Ansible Tower also ...
Michael Hampton's user avatar
4 votes
Accepted

Puppet and systemctl trouble

The quotes on this line are likely to be causing the problem: service {"$ntp_services": Using "" containing a variable will create a string with the variable expanded inside it. This is probably why ...
Dominic Cleal's user avatar
2 votes
Accepted

Get array output in puppet ERB from hiera

Expanding the comment from jordanm - you can use the to_json function from the puppetlabs-stdlib module - source. In your Puppet manifest: class profiles::xxx( $master_servers, ) { $...
Craig Watson's user avatar
  • 9,660
2 votes

how to make our servers aware of the names of the other servers in the environment in Puppet

I would recommend PuppetDB, which is designed for exactly this. In particular it allows the use of Exported Resources, so that all hosts in a group can export a resource and it can be collected on ...
shearn89's user avatar
  • 3,486
2 votes

Puppet/hiera : generate sereval files from one template

You need a defined type define test::clusters ( $text = undef ) { file { "/tmp/${title}": ensure => $ensure, owner => 'root', group => 'root', content => ...
jaxxstorm's user avatar
  • 626
2 votes
Accepted

Does Puppet 2.7 allow a class inheritance of an unparameterized "params" class?

Your init.pp class should read: class myclass ( $zone = 'top', $base_url = $::myclass::params::base_url, $username = $::myclass::params::username, ) inherits myclass::params { You don't ...
J Earls's user avatar
  • 231
1 vote
Accepted

How do I run hiera standalone to test values?

You can't dump the whole of the hiera data for a node. If you look at the api for creating custom back-ends for hiera you'll see that there's nothing for returning the whole data set or a list of ...
mc0e's user avatar
  • 5,921
1 vote

Puppet Class Lookup from Hiera with Automated Chaining

Unfortunately, You can't pull in classes from Hiera like this and define relationships at the same time. You could use stages to ensure that joining the domain comes first. Then, your application ...
Aaron Copley's user avatar
  • 12.7k
1 vote
Accepted

Puppet parse hiera in inline_template

There's a problem with either your data structure or your logic, or both. I am not sure I have enough here to sort out which. The first issue I see is your hiera() lookup function cannot lookup the ...
Aaron Copley's user avatar
  • 12.7k
1 vote

Puppet : call define type in class from hiera

The error you are seeing is a scope problem. The def_package defined type has been defined within the install_package class, so its full name is actually install_package::def_package. In Puppet, ...
Jon's user avatar
  • 126
1 vote

create textfile in puppet from hiera list

First you need to loop over your array, then you need to take the value of every hash, because you have an array with hash: sqldbs = lookup('dbs') each($sqldbs) |$db| { notice($db) } root@...
c4f4t0r's user avatar
  • 5,381
1 vote
Accepted

Encrypting properties with "eyaml edit" without a private key?

The ability to use "eyaml edit" without the private key has been added in the master branch in GitHub. This is how I am currently using it. First configure eyaml so that it knows where your public ...
Mark McLaren's user avatar
1 vote
Accepted

Using Foreman's host groups in hiera.yaml :hierarchy section

I have got a solution... At first I looked to puppetserver process with strace, and after running puppet agent on managed host I saw this in its output: [pid 7997] stat("/etc/puppetlabs/code/...
patok's user avatar
  • 692
1 vote
Accepted

Best way for user management with Hiera

Implement default attributes for each user in the type definition: define user($managehome = true) { ... } Yes, you need to use merging, but rather than specifying it in the hiera data, use the ...
womble's user avatar
  • 97k
1 vote

failing to look up hiera-file value from puppet

Hmm. Well that was quick. I figured it out myself. puppetserver keeps its own set of gems, so I had to do: puppetserver gem install hiera-file service puppetserver restart
mc0e's user avatar
  • 5,921
1 vote
Accepted

Vagrant Puppet apply manifest with wrong environment

You can specify all options for your puppet run. You can use something like this: srv.vm.provision :puppet do |puppet| puppet.working_directory = "/vagrant/puppet" puppet.module_path ...
Marc Lambrichs's user avatar
1 vote

Return yaml value to puppet fact lookup

Figured it: file { '/boot/config.txt' : ensure => present, mode => '0755', content => $::hostname?{ hiera('server_name_in_hiera') => template('template1'), default =&...
Dave Shaw's user avatar
1 vote

How to reference a hiera variable from elsewhere the hierarchy?

See the answer from Greg Dubicki. To quote "The hiera, hiera_array, hiera_hash, and hiera_include functions are all deprecated. The lookup function is a complete replacement for all of these.&...
Michael Hurn's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible