FAQ Database Discussion Community


How to add values to a YAML hash using Ruby

ruby,hash,yaml,webhooks,hiera
I have a bunch of Hashes in a YAML file (its for Puppet/Hiera based config of some servers) that looks like so: --- apache_vhosts: 'webuser.co.uk': ip: '*' port: '80' serveraliases: ['www.webuser.co.uk',] add_listen: false docroot: '/home/webuser/public_html' docroot_owner: 'webuser' docroot_group: 'apache' serveradmin: '[email protected]' scriptalias: '/home/webuser/public_html/cgi-bin/' access_log_format: '\"%{X-Forwarded-For}i\" %l %u %t \"%r\" %>s...

Using duritong/puppet-shorewall with Puppet and Hiera does not work as expected

puppet,hiera
I am trying to use this module here with puppet: https://github.com/duritong/puppet-shorewall Following the example I got the rules working node xy { class{'config::site_shorewall': startup => "0" # create shorewall ruleset but don't startup } shorewall::rule { 'incoming-ssh': source => 'all', destination => '$FW', action => 'SSH(ACCEPT)', order => 200; 'incoming-puppetmaster':...

Using hiera to set class parameters?

puppet,hiera
I am trying to figure out how to use hiera for setting the values for class parameters. I am testing things out with two simple classes: testhiera and testhiera2 Here are those classes: [[email protected] modules]# cat testhiera/manifests/init.pp class testhiera ( $haproxy_cert_content = 'unknown' , ) { notify {"cert is $haproxy_cert_content":}...

Do basica math inside of hiera

puppet,hiera
I'm trying to set a crontab's weekday in hiera based on a custom fact and a basic modulo but I can't even figure out if it's possible. I'd like to do something like: cron-job: command: "do something" user: myuser hour: "%{::instance}" minute: "%{::instance}" weekday: "%{::instance}" % 7 Can that even...

Configuring Hiera on Puppet Enterprise

puppet,hiera,puppet-enterprise
I am new to Puppet and Hiera, and having a configuration issue when attempting to apply a module the contains a Hiera lookup to an agent. From /etc/puppetlabs/puppet/hiera.yaml: --- :backends: - yaml :hierarchy: - defaults - "%{clientcert}" - "%{environment}" - global :yaml: :datadir: '/etc/puppetlabs/puppet/hiera' From /etc/puppetlabs/puppet/hiera/develop.yaml: git_client: file_content:here When running...

How can I avoid “write everything twice” in my hiera data?

puppet,hiera
Is there a better way to format my hiera data? I want to avoid the "write everything twice" problem. Here is what I have now: [[email protected] ~]# cat example.yaml --- controller_ips: - 10.0.0.51 - 10.0.0.52 - 10.0.0.53 controller::horizon_cache_server_ip: - 10.0.0.51:11211 - 10.0.0.52:11211 - 10.0.0.53:11211 I was wondering if there is...

TDD a Hiera hash in Puppet

hash,rspec,tdd,puppet,hiera
spec/classes/test_spec.rb require 'spec_helper' describe 'test' do let(:hiera_data) { { :a => 'hello' } } it { should contain_file('/tmp/hello') } end manifests/init.pp class test { $a = hiera('a') file {"/tmp/$a":} } results in: [[email protected] test]$ rspec . Finished in 1.11 seconds (files took 3 seconds to load) 1 example, 0 failures...

Group nodes in hiera by hiera-defined fact

puppet,configuration-files,hiera
I have a hierachy like this: - "nodes/%{::certname}" - (what's here is my question) - common I'd like to assign a group to my nodes in their individual configuration in hiera, like this in nodes/hostname.yaml : --- group: alpha Now, I'd like to have a file alpha.yaml, where I state...

Is it possible to use a join-like function either in Hiera or Puppet?

dictionary,puppet,hiera
I got a list of IPs in a yaml file: --- ips: 1.1.1.1 2.2.2.2 3.3.3.3 Furthermore the IPs are used (interpolated) in another variable params: value: "%{hiera('ips')}" This works so far. The content is 1.1.1.1 2.2.2.2 3.3.3.3 In a module I need to join each of these ips with a...

Basic usage of modules in puppet with hiera

module,puppet,hiera
I want to use puppet to manage some servers. Even after reading dozens of documentation pages, it is not clear to me how to use modules and how to use them with hiera. As first experiment I wanted a user "admin" to be created on one node and found this...

hiera-eyaml undefined method `empty?'

yaml,puppet,hiera
I would like to store my node config in a .eyaml file. "hieradata/node/client.puppetmaster.local.eyaml" --- ntp::restrict: - ntp::autoupdate: false ntp::enable: true ntp::servers: - 0.pool.ntp.org - 1.pool.ntp.org - 2.pool.ntp.org - 3.pool.ntp.org but when I try to read a parameter with hiera ntp::servers ::fqdn=puppet.puppetmaster.local I get this error Messages /var/lib/gems/1.9.1/gems/hiera-eyaml-2.0.7/lib/hiera/backend/eyaml_backend.rb:39:in `block in lookup':...

Trying to use hiera with vagrant and puppet

debian,vagrant,puppet,hiera
So I am trying to use hiera to change how I set up the git user.name and user.email. on my vagrant box. I have this in my default.pp git::config { 'user.name': value => hiera("github_username"), } git::config { 'user.email': value => hiera("github_email"), } In the Vagrant file I have this (inside...