-
-
Save l1x/1747763 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Match all nodes with FQDN ending in example.com | |
function(doc) { | |
if(doc.attributes.fqdn) { | |
var prefix = doc.attributes.fqdn.match(/^.*example.com$/); | |
if(prefix) { | |
emit(prefix, null); | |
} | |
} | |
} | |
// Match all nodes with virtualization role "host" | |
function(doc) { | |
if(doc.attributes.virtualization && doc.attributes.virtualization.role) { | |
if(doc.attributes.virtualization.role == 'host'){ | |
emit(doc.attributes.fqdn, 'is a host'); | |
} | |
} | |
} | |
// Find all nodes with run_list > 0 (i.e. with recipies, roles applied) | |
function(doc) { | |
if (doc.chef_type == "node") { | |
if (doc['run_list'].length > 0) { | |
emit(doc.name, doc['run_list']); } | |
} | |
} | |
// Find all nodes with run_list == 0 (i.e. with recipies, roles applied) | |
function(doc) { | |
if (doc.chef_type == "node") { | |
if (doc['run_list'].length == 0) { | |
emit(doc.name, doc['run_list']); } | |
} | |
} | |
// Find all RedHat Enterprise Linux 4 nodes | |
function(doc) { | |
if (doc.chef_type == "node") { | |
platform = doc.attributes.platform | |
pversion = doc.attributes.platform_version | |
if (platform == 'redhat' && pversion == '4') { | |
emit(doc.name, 'RHEL 4'); } | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment