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 the ...
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 ...
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 ...
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,
) {
$...
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
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
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 ...
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
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 ...
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 ...
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, ...
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@...
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 ...
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/...
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.&...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
hiera × 84puppet × 81
puppetmaster × 8
foreman × 7
yaml × 5
hierarchy × 5
vagrant × 3
satellite × 3
facter × 3
linux × 2
debian × 2
sudo × 2
automation × 2
template × 2
puppetdb × 2
centos × 1
redhat × 1
centos7 × 1
samba × 1
centos6 × 1
ansible × 1
installation × 1
apache2 × 1
nagios × 1
encryption × 1