Incase somebody googles to here
i found this
puppet apply --certname=<abc> -e "notice(hiera('classes'))" --noop
--verbose
This shows me what the puppet master is giving as classes for a specific
node based on certname.
also
hiera -d classes ::osfamily=RedHat environment=production
::trusted.certname=<abc>
on the puppet master to give you info from hiera .. helpful
On Monday, 27 June 2016 17:02:31 UTC+10, Alex Samad wrote:
>
> Hi
>
> Okay, I have downloaded and will re do he trainging VM.
>
> But I have finished the reading this blog
> http://www.craigdunn.org/2012/05/239/ << suggested to me here.
>
> This is basically what i am trying to do. But I would like to see /
> test what I am doing along the way
>
> The install of puppet / hiera was by the documentation .
>
> I have added in an ENC - only so I can allocate (in on place) node to
> environments and potentially ??
>
> I have a test node and I try the puppet agent -t --noop --verbose
> hoping to see some results of my work on the puppet master.
>
> I have seen - cert request and I have signed this.
>
> Now this is what I am probably missing is the link in the production
> environment to the class list - via roles / profiles ?
>
> I am presuming I need to look at work with
> /etc/puppetlabs/code/environments/production/manifests/site.pp
> and get that to work with hiera ..
>
> Alex
>
>
>
> On 27 June 2016 at 14:56, Peter Kristolaitis <[email protected]> wrote:
> > You may want to go back and re-read my previous message.
> >
> > You're missing the very, very critical distinction that Hiera is not
> your
> > node manifest. Hiera is just data, and does not configure any resources
> for
> > the agent to manage. You still need to write your node manifest files.
> > Note that this differs from a class manifest.
> >
> >
> >
> > On 6/27/2016 12:23 AM, Alex Samad wrote:
> >>
> >> Hi
> >>
> >> Okay, i do it a bit simpler :)
> >>
> >> /etc/puppetlabs/puppet/hiera.yaml
> >>
> >> i added
> >>
> >> message: "This node is using global common data"
> >>
> >> sudo /opt/puppetlabs/bin/puppet agent --noop --verbose -t
> >>
> >> didn't see the text message !
> >>
> >>
> >>
> >>
> >> On 27 June 2016 at 13:14, Peter Kristolaitis <[email protected]>
> wrote:
> >>>
> >>> It's important to keep in mind that Hiera is "just data". You still
> need
> >>> to
> >>> actually create the resources somehow in your manifest based on that
> >>> data.
> >>>
> >>> Thus, creating a data element called "classes" in Hiera isn't enough
> to
> >>> actually get those classes applied to the node. You need to add
> >>> hiera_include('classes') in your manifest. More info here:
> >>>
> >>>
> https://docs.puppet.com/hiera/3.1/puppet.html#assigning-classes-to-nodes-with-hiera-hierainclude
>
> >>>
> >>> Having said that, until you get more experience with Puppet I would
> >>> recommend avoiding using Hiera to assign classes to nodes. It can be
> >>> harder
> >>> to debug and maintain, and breaks the rule of thumb that Hiera should
> >>> only
> >>> contain configuration data and not class structure. You may want to
> look
> >>> into the "roles and profiles" model instead. There ARE valid reasons
> to
> >>> assign classes via Hiera (e.g. assigning a role to the node based on
> the
> >>> output of a custom Hiera backend) but this wouldn't be the approach I
> >>> recommend to a newbie. :)
> >>>
> >>>
> >>> On 6/26/2016 8:41 PM, Alex Samad wrote:
> >>>
> >>> Hi
> >>>
> >>> Newbie - greenfield install . Centos 6.8 - PC1 puppet. Master puppet
> >>> setup.
> >>>
> >>> I have installed R10K and git and hiera.
> >>>
> >>> I would like to group my nodes into groups
> >>>
> >>> I'm doing some testing
> >>>
> >>> testnode - puppet client
> >>> masternode - puppet master
> >>>
> >>> On the master node I have
> >>>
> >>>
> >>> cat /etc/puppetlabs/puppet/puppet.conf
> >>> # This file can be used to override the default puppet settings.
> >>> # See the following links for more details on what settings are
> >>> available:
> >>> # -
> >>>
> >>>
> https://docs.puppetlabs.com/puppet/latest/reference/config_important_settings.html
>
> >>> # -
> >>>
> >>>
> https://docs.puppetlabs.com/puppet/latest/reference/config_about_settings.html
>
> >>> # -
> >>>
> https://docs.puppetlabs.com/puppet/latest/reference/config_file_main.html
> >>> # -
> >>> https://docs.puppetlabs.com/puppet/latest/reference/configuration.html
> >>> [master]
> >>> vardir = /opt/puppetlabs/server/data/puppetserver
> >>> logdir = /var/log/puppetlabs/puppetserver
> >>> rundir = /var/run/puppetlabs/puppetserver
> >>> pidfile = /var/run/puppetlabs/puppetserver/puppetserver.pid
> >>> codedir = /etc/puppetlabs/code
> >>>
> >>> # https://docs.puppet.com/puppetdb/4.1/connect_puppet_master.html
> >>> storeconfigs = true
> >>> storeconfigs_backend = puppetdb
> >>>
> >>> reports = store,puppetdb
> >>>
> >>>
> >>> # https://docs.puppet.com/guides/external_nodes.html
> >>> node_terminus = exec
> >>> external_nodes = /usr/local/bin/puppet_node_classifier
> >>>
> >>>
> >>>
> >>>
> >>> I was use a node classifier at the top level to place nodes into
> >>> environments - but I am testing grouping nodes in to groups in 1 env/
> >>>
> >>> all it produces is
> >>> ---
> >>> environment: alex
> >>>
> >>>
> >>> for now
> >>>
> >>>
> >>> cat /etc/puppetlabs/puppet/hiera.yaml
> >>> # https://docs.puppet.com/hiera/3.1/configuring.html
> >>> ---
> >>> :backends:
> >>> - yaml
> >>> :hierarchy:
> >>> - "nodes/%{::trusted.certname}"
> >>> - 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:
> >>>
> >>>
> >>>
> >>> This is the default hiera setup
> >>>
> >>>
> >>> cat /etc/puppetlabs/code/environments/alex/hieradata/common.yaml
> >>> ---
> >>> classes:
> >>> - profile::mypuppet
> >>>
> >>> message: "This node is using common data"
> >>>
> >>> #Puppet Server Tuning
> >>>
> puppet_enterprise::master::puppetserver::jruby_max_requests_per_instance:
> >>> 0
> >>>
> >>>
> >>>
> >>> cat
> >>>
> /etc/puppetlabs/code/environments/alex/site/profile/manifests/mypuppet.pp
> >>> class profile::mypuppet {
> >>>
> >>> package { 'puppet-agent' :
> >>> ensure => 'present',
> >>> }
> >>>
> >>> #include ::puppet_agent;
> >>>
> >>> }
> >>>
> >>>
> >>>
> >>> then i go to my test node
> >>>
> >>> # for testing ..
> >>> sudo /opt/puppetlabs/bin/puppet agent --noop --verbose -t
> >>> Notice: Local environment: 'production' doesn't match server specified
> >>> node
> >>> environment 'alex', switching agent to 'alex'.
> >>> Info: Retrieving pluginfacts
> >>> Info: Retrieving plugin
> >>> Info: Loading facts
> >>> Info: Applying configuration version
> >>> 'ee80ea6b15178f517618992833a8bc3c7c378bd0'
> >>> Notice: Applied catalog in 0.04 seconds
> >>>
> >>> I don't see any mention of mypuppet ??
> >>>
> >>> Am i testing the system the right way ?
> >>> What am i doing wrong ?
> >>>
> >>> Thanks
> >>> Alex
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>> --
> >>> 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 [email protected].
> >>> To view this discussion on the web visit
> >>>
> >>>
> https://groups.google.com/d/msgid/puppet-users/a7bb4a4b-d61b-4db0-bdff-57030d75cb51%40googlegroups.com.
>
>
> >>> For more options, visit https://groups.google.com/d/optout.
> >>>
> >>>
> >>> --
> >>> You received this message because you are subscribed to a topic in the
> >>> Google Groups "Puppet Users" group.
> >>> To unsubscribe from this topic, visit
> >>> https://groups.google.com/d/topic/puppet-users/OAtIhSwbyEs/unsubscribe.
>
> >>> To unsubscribe from this group and all its topics, send an email to
> >>> [email protected].
> >>> To view this discussion on the web visit
> >>>
> >>>
> https://groups.google.com/d/msgid/puppet-users/cb352a0f-20a3-c79c-ada2-fe717850ebff%40alter3d.ca.
>
>
> >>>
> >>> For more options, visit https://groups.google.com/d/optout.
> >
> >
> > --
> > You received this message because you are subscribed to a topic in the
> > Google Groups "Puppet Users" group.
> > To unsubscribe from this topic, visit
> > https://groups.google.com/d/topic/puppet-users/OAtIhSwbyEs/unsubscribe.
> > To unsubscribe from this group and all its topics, send an email to
> > [email protected].
> > To view this discussion on the web visit
> >
> https://groups.google.com/d/msgid/puppet-users/5ba1e92d-4464-15a9-fdd6-bea433b554c3%40alter3d.ca.
>
>
> >
> > For more options, visit https://groups.google.com/d/optout.
>
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-users/8484383e-f810-4963-86b5-66fce06f3609%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.