5
votes
Accepted
Trouble using hiera in masterless setup and getting values set for classes
Try this:
hiera cluster '::nodetype=diskless'
See fact-sources documentation
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 ...
5
votes
Accepted
How to reference a hiera variable from elsewhere the hierarchy?
You can use Hiera lookup functions within Hiera. Documentation here: https://docs.puppetlabs.com/hiera/1/variables.html#using-lookup-functions
In your case you would use:
server_name: "service-%{...
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 ...
4
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.
...
4
votes
Accepted
Puppet noob, stuck on the same error for hours
You have to define a node in $PUPPETDIR/manifests/site.pp (or node.pp, as this is usually imported from site.pp and is meant to keep node defs).
3
votes
Accepted
Satellite 6's puppet is unable to find the hiera data sources
After thinking about it on my commute, decided to check out SELinux and there it was:
[root@foosat hiera]# grep yaml /var/log/audit/audit.log | head -n1
type=AVC msg=audit(1430926955.728:75727): avc: ...
3
votes
Accepted
How to instantiate multiple instances of the same resource using Hiera
Use hashes for your data and use create_resources to instantiate.
The Puppet documentation has an example for users. The StackOverflow question
Puppet hiera and create_resource issue covers basically ...
3
votes
How do I use saz-sudo puppet module to deploy my own sudoers file with hiera?
According to the README, you need to send a parameter to the sudo class:
class { 'sudo':
config_file_replace => true,
}
instead of plain
include sudo
which clobbers /etc/sudoers as stated.
2
votes
Accepted
How do I use saz-sudo puppet module to deploy my own sudoers file with hiera?
Is that an exact copy from your file? The class { 'site_sudo': } line would include that class into the config, not define the class as you should be doing in the init.pp for the module. This will ...
2
votes
How to set up :datadir: when using Hiera with Puppet and Vagrant
The hiera.yaml I'm working with specifies :datadir: /etc/puppet/hiera and I had no luck with setting the --yamldir option as some of the other answers specified. However, I realised after a while that ...
2
votes
Accepted
Install of hiera-puppet-1.0.0-1.el6.noarch conflicts with file from package puppet-3.7.1-1.el6.noarch
Puppet 3 includes hiera and doesn't need/require any additional packages being installed for it.
2
votes
Accepted
Puppet module not run on agents while this has been defined in Hiera on the Puppetmaster
The Puppetmaster needs to be restarted if the hiera.yaml has been changed
The format of the hiera files is important, i.e. two spaces instead of null and ---
common.yaml
---
classes:
- motd
...
2
votes
Accepted
How to return default hash keys in hiera_hash() call?
You need the hash merge function from the stdlib module.
merge: Merges two or more hashes together and returns the resulting hash.
Example:
$hash1 = {'one' => 1, 'two' => 2}
$hash2 = {'two' =&...
2
votes
Hiera lookup based on pattern
I was looking for the same thing for a similar reason. and have found that hiera backedn in github helpful jjulien/hiera-regex . As an example from the project itself readme file:
you have to ...
2
votes
Accepted
Get value from hiera hash in Puppet
This is an application for the create_resources method.
In your case, you would not fetch the hash from inside the resource, but from outside:
# puppet/site.pp
create_resources(create_folder, ...
2
votes
Accepted
Puppet: How to fix "Unknown function hiera_include"?
It could be possible that you would need to manually copy the function rb file into /usr/lib/ruby/gems/1.8/gems/puppet-${version}/lib/puppet/parser/functions/ however I would highly advise to not run ...
2
votes
how to create array of arrays from hiera in puppet
You are, I believe, doomed (in general). The hiera_array documentation specifically mentions that the values returned are a "flattened array". It further clarifies the situation:
If any of the ...
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 ...
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 => ...
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 ...
2
votes
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,
) {
$...
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 ...
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
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 ...
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 =&...
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.&...
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 ...
1
vote
Using hiera to include modules in example42/apache
Figured it out, need to use apache::module_hash for that. Not really said in the doc, just showed at one point. Works for everything, there is also a vhost_hash, dotconf_hash ...
Pretty cool !
1
vote
Accepted
Disable Puppet ENC part in Foreman
Foreman is only an ENC, which means that it will send a YAML formatted set of classes and variables to the Puppet master when asked to do so.
If a variable is in Hiera, and you do not override it ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
hiera × 82puppet × 79
puppetmaster × 8
foreman × 7
hierarchy × 5
yaml × 4
vagrant × 3
satellite × 3
facter × 3
linux × 2
debian × 2
automation × 2
template × 2
puppetdb × 2
centos × 1
redhat × 1
centos7 × 1
samba × 1
centos6 × 1
installation × 1
ansible × 1
nagios × 1
sudo × 1
encryption × 1
regex × 1