Skip to content

Instantly share code, notes, and snippets.

@walterheck
Created February 8, 2015 21:00
Show Gist options
  • Select an option

  • Save walterheck/4cce563672acb8efdd3f to your computer and use it in GitHub Desktop.

Select an option

Save walterheck/4cce563672acb8efdd3f to your computer and use it in GitHub Desktop.
[root@ip-172-30-0-156 modules]# tree
.
└── walter
└── lib
└── facter
└── walter.rb
3 directories, 1 file
[root@ip-172-30-0-156 modules]# pwd
/etc/puppetlabs/puppet/environments/production/modules
[root@ip-172-30-0-156 modules]# cat /var/opt/lib/pe-puppet/lib/facter/walter.rb
Facter.add('walter') do
setcode 'desktop'
end
[root@ip-172-30-0-156 modules]# cat ../manifests/site.pp
## site.pp ##
# This file (/etc/puppetlabs/puppet/manifests/site.pp) is the main entry point
# used when an agent connects to a master and asks for an updated configuration.
#
# Global objects like filebuckets and resource defaults should go in this file,
# as should the default node definition. (The default node can be omitted
# if you use the console and don't define any other nodes in site.pp. See
# http://docs.puppetlabs.com/guides/language_guide.html#nodes for more on
# node definitions.)
## Active Configurations ##
# PRIMARY FILEBUCKET
# This configures puppet agent and puppet inspect to back up file contents when
# they run. The Puppet Enterprise console needs this to display file contents
# and differences.
# Define filebucket 'main':
filebucket { 'main':
server => 'ip-172-30-0-156.us-west-2.compute.internal',
path => false,
}
# Make filebucket 'main' the default backup location for all File resources:
File { backup => 'main' }
# DEFAULT NODE
# Node definitions in this file are merged with node data from the console. See
# http://docs.puppetlabs.com/guides/language_guide.html#nodes for more on
# node definitions.
# The default node definition matches any node lacking a more specific node
# definition. If there are no other nodes in this file, classes declared here
# will be included in every node's catalog, *in addition* to any classes
# specified in the console for that node.
node default {
# This is where you can declare classes for all nodes.
# Example:
# class { 'my_class': }
notify{"fact on ${::fqdn} is ${::walter}":}
}
[root@ip-172-30-0-156 modules]# puppet agent -t
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
Info: Caching catalog for ip-172-30-0-156.us-west-2.compute.internal
Info: Applying configuration version '1423429139'
Notice: fact on ip-172-30-0-156.us-west-2.compute.internal is
Notice: /Stage[main]/Main/Node[default]/Notify[fact on ip-172-30-0-156.us-west-2.compute.internal is ]/message: defined 'message' as 'fact on ip-172-30-0-156.us-west-2.compute.internal is '
Notice: Finished catalog run in 6.31 seconds
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment