nocturnalwarz / puppetlabs-nodesearch Goto Github PK
View Code? Open in Web Editor NEWThis project forked from bodepd/puppetlabs-nodesearch
Experiment for querying data out of storedconfigs
License: Apache License 2.0
This project forked from bodepd/puppetlabs-nodesearch
Experiment for querying data out of storedconfigs
License: Apache License 2.0
LICENSE: Apache v2 AUTHOR: Dan Bode This is currently a prototype. Overview: This module provides facilities for searching for a list of nodes using facts and classes contained in the last compiled catalag as filters. Pre-requisites: This code will only work against Puppet 2.7.3 or higher. It requires that storedconfigs is enabled. For more information about configuring storedconfigs, look here: http://projects.puppetlabs.com/projects/1/wiki/Using_Stored_Configuration This has only been tested against mysql as the backend for storedconfigs. Usage: command line: To use puppet hostclass from the command line, you will have to add the lib directory of this module to your RUBYLIB env variabe. export RUBYLIB=/etc/puppet/modules/puppetlabs-nodesearch/lib:$RUBYLIB # returns a list of nodes whose last compiled catalog contains # the classes foo, bar, AND baz puppet hostclass search --classes foo,bar,baz As a puppet function: from within Puppet, you can invoke the function search_nodes search nodes allows you to specify both facts as well as classes to use as a filter for searching nodes. If you intend to use facts as filters, then you will need to set inventory_active_record as the facts terminus in puppet.conf (as as an option to puppet). facts_terminus=inventory_active_record The functions search_nodes takes a hash as the only parameter. The hash can have either keys prefixed with facts. or a key called classes which expects an array. Examples of usage: The following example shows how the function could be used to grant access to a database to only nodes that have been assigned a specific class. node db::server { class { 'db::server': # authorize clients that use the class db::client allowed_clients => search_nodes({classes => ['db::client']}), } } Full examples have been provided in the examples directory: Below is the main section from puppet.conf that I used for testing: [main] storeconfigs = true dbadapter = mysql dbname = puppet dbserver = localhost dbuser = root dbpassword = password dbsocket = /var/lib/mysql/mysql.sock facts_terminus=inventory_active_record modulepath=/etc/puppet/modules:/etc/puppet/modules/puppetlabs-nodesearch/examples/modules manifest=/etc/puppet/modules/puppetlabs-nodesearch/examples/manifests/site.pp
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.