Ask Your Question
0

How to set parameters with hiera for a class included in default.pp

asked 2016-03-11 12:21:03 -0600

jack9 gravatar image

setup:

  • no puppetmaster
  • puppet version 4.3.1
  • hiera 1.3.0

currently the default.pp looks like that:

node default {
  class { 'ntp': servers => [ 'ntp.ubuntu.com' ] }
}

class { 'apt':
  purge_sources_list => true,
  purge_sources_list_d => true,
  purge_preferences_d => true,
}

hiera_include('roles', [])
hiera_include('sites', [])

hiera.yaml looks like that:

---
:backends:
  - yaml
:hierarchy:
  - "%{::clientcert}"
  - "%{::environment}"
  - "%{::domain}"
  - "virtual_%{::is_virtual}"
  - common

:yaml:
  :datadir: "/etc/puppetlabs/code/environments/%{::environment}/hieradata"

vagrant.yaml

---
roles:
  - roles::nginx
  - roles::java8

apt::sources:
  "openjdk-8":
    location: "http://ppa.launchpad.net/openjdk-r/ppa/ubuntu"
    release: trusty
    repos: main
    include_src: false
    include_deb: true
    key: 'DA1A4A13543B466853BAF164EB9B1D8886F44E2A'

everything works like charm but now i would like to remove the three parameters from the apt class and setting them with hiera. apt::sources: are correclty looked up via hiera but if i add apt: it does nothing

adding this to my hiera file does not help:

apt::
  purge_sources_list:   false
  purge_sources_list_d: false
  purge_preferences_d:  false

also tried apt::init: as key

it it possible to set the parameter via hiera without using `hiera_include('classes')?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2016-03-13 01:09:45 -0600

The correct syntax is:

apt::purge_sources_list: true
apt::purge_sources_list_d: true
apt::purge_preferences_d: true
edit flag offensive delete link more

Comments

thank you very much. just starting to use hiera :)

jack9 gravatar imagejack9 ( 2016-03-13 20:05:21 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2016-03-11 12:21:03 -0600

Seen: 173 times

Last updated: Mar 13 '16