## Overview Up to MCollective 2.0.0 the discovery system could only discover against the network by doing broadcasts over the middleware.
The direct addressing capability introduced in 2.0.0 enables users to communicate with a node without doing broadcast if they know the configured identity of that node.
In version 2.1.0 we are introducing a new kind of plugin that works on the client system to do discovery against any data source that can return a list of identities such as flatfiles or databases.
Your mcollective client has a setting called default_discovery_method that defaults to mc, if you change this in your client.cfg to another known plugin you can use that instead.
To get a list of known discovery plugins use the mco plugin application:
Each plugin can have a different set of capabilities, for example a flatfile with only hostnames cannot do class or fact based filters and you will receive an error if you tried to do so. You can see the capabilities of each plugin using the mco plugin application:
Here you can see the only capability that this plugin has is to filter against identities.
These plugins require DDL files to be written and distributed when installing each plugin.
When using the mcollective CLI you can choose which plugin to use per request, some plugins require arguments like the file to discover against:
In the case of the flatfile plugin there is a convenient shortcut available on all client applications that has the same effect as above:
Any request that uses the compound filters using -S will be forced to use the network broadcast discovery method.
Writing your own discovery plugin is very simple, you need to provide one method that returns an array of node names.
The plugins only need to be present on the client machines but no harm in installing them on all machines. They need to be installed into the discovery directory in the usual plugin directory. You can use the mco plugin package command to create RPM or DEB packages for these plugins.
This is the flatfile plugin that is included in the distribution. You can see it using the client.options[:discovery_options] array to get access to the file supplied using the –do command line argument, reading that file and doing either string or Regular Expression matching against it finally returning the list of nodes.
As mentioned each plugin needs a DDL, the DDL for this plugin is very simple:
Here we expose just the one capability, valid capabilities would be :classes, :facts, :identity, :agents and :compound. In practise you cannot create a plugin that supports the :compound capability as mcollective will force the use of the mc plugin if you use those.