Hi,

I'm setting up Puppet 4.0 for the first time and I'm probably missing 
something. In my hiera.yaml:

---
:backends:
  - yaml
:hierarchy:
  - "%{application}"
  - common


:yaml:
# datadir is empty here, so hiera uses its defaults:
# - /etc/puppetlabs/code/environments/%{environment}/hieradata on *nix
# - %CommonAppData%\PuppetLabs\code\environments\%{environment}\hieradata 
on Windows
# When specifying a datadir, make sure the directory exists.
  :datadir: "/etc/puppetlabs/code/environments/%{environment}/hieradata"
#  :datadir: /etc/puppetlabs/code/environments/development/hieradata

With this setting I get this on the node:

root@dc1dapp01:~# facter -p | grep application
application => app
root@dc1dapp01:~#
root@dc1dapp01:~# puppet agent -t
Info: Using configured environment 'development'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
Info: Caching catalog for dc1dweb01.example.com
Info: Applying configuration version '1502632775'
Notice: site.pp
Notice: /Stage[main]/Main/Notify[site.pp ]/message: defined 'message' as 
'site.pp 
'
Notice:  this is the role_basic role
Notice: /Stage[main]/Role_basic/Notify[ this is the role_basic role ]/
message: defined 'message' as ' this is the role_basic role '
Notice: Applied catalog in 0.05 seconds

But if i explicitly point to environment development in the Hiera.yaml 
file, I get the following output (this is the behavior I want):

root@dc1dapp01:~# puppet agent -t
Info: Using configured environment 'development'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
Info: Caching catalog for dc1dweb01.example.com
Info: Applying configuration version '1502632844'
Notice: site.pp
Notice: /Stage[main]/Main/Notify[site.pp ]/message: defined 'message' as 
'site.pp 
'
Notice:  this is the APP1 module
Notice: /Stage[main]/App1/Notify[ this is the APP1 module ]/message: defined 
'message' as ' this is the APP1 module '
Notice: Applied catalog in 0.03 seconds

I have a fact for the application that I want to run a specific 
role/profile for. Can anyone explan what I'm missing please?

Thanks for your help.

Here are some of my other config files:

environment.conf

# Each environment can have an environment.conf file. Its settings will only
# affect its own environment. See docs for more info:
# 
https://docs.puppetlabs.com/puppet/latest/reference/config_file_environment.html


# Any unspecified settings use default values; some of those defaults are 
based
# on puppet.conf settings.


# If these settings include relative file paths, they'll be resolved 
relative to
# this environment's directory.


# Allowed settings and default values:


 modulepath = ./modules:$basemodulepath
# manifest = (default_manifest from puppet.conf, which defaults to 
./manifests)
# config_version = (no script; Puppet will use the time the catalog was 
compiled)
# environment_timeout = (environment_timeout from puppet.conf, which 
defaults to 0)
    # Note: unless you have a specific reason, we recommend only setting
    # environment_timeout in puppet.conf.

# cat manifests/site.pp


notify { 'site.pp ': }
#hiera_include('classes')


  $role = hiera('classes','role_basic')
  include $role




-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/48f429f5-5640-40ca-94ed-7c1128262726%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to