:))) seems like after writing this I found my answer
I used puppet agent --test --verbose shows me that it is classified as environment alex. thats good. but puppet config print environment still show production? so I am guessing the above just looks at the puppet config files and as I haven't set environment it defaults to production ! So the question is, is this the best way to do it ? Alex On Wednesday, 22 June 2016 17:13:04 UTC+10, Alex Samad wrote: > > Hi > > Might have this wrong. But.. > > I have puppet install - got r10k and will be using hiera > > I wanted to have 1 script / programatic way of classifying scripts into > environments. I wanted to be able to look at certname and maybe ip address. > > So I found this > https://docs.puppet.com/guides/external_nodes.html > > I have added this > > [master] > node_terminus = exec > external_nodes = /usr/local/bin/puppet_node_classifier > > > to my /etc/puppetlabs/puppet/puppet.conf at the bottom > > for this /usr/local/bin/puppet_node_classifier i have > > #!/bin/bash > > # > # puppet external node classifier > # https://docs.puppet.com/guides/external_nodes.html > # > > > echo "$*" > /tmp/a1 > > set -e > > HSTNAME="$1" > > if [ -z "$HSTNAME" ] > then > # can't be called with no arguments > exit 1 > fi > > > case "$HSTNAME" in > testing.xyz.com) > echo "---" > > #echo "classes:" > #echo " - common" > #echo "parameters:" > > #echo "environment: production" > echo "environment: alex" > ;; > *) > exit 1 > ;; > esac > > echo > > exit 0 > > > > when i go to box testing.xyz.com which is the box I have installed > puppet on and try this > puppet config print environment > > I still get production not alex > > > what am i doing wrong ? > How do I try and debug this (where do i look)? > > Is this the right way to do it. our should I be adding nodes to config > files (which ones?) in the environments or one master file in the global > sites.pp (is this the file and if so where does it exist ) > > Thanks > Alex - slightly confused > > > -- 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/a27fb92d-5d8b-42a9-a9e6-aa89f28f130f%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
