Ask Your Question

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

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

jack9 gravatar image


  • no puppetmaster
  • puppet version 4.3.1
  • hiera 1.3.0

currently the default.pp looks like that:

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

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:

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

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


  - roles::nginx
  - roles::java8

    location: ""
    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:

  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

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


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


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

Seen: 274 times

Last updated: Mar 13 '16