--- layout: default title: Writing Fact Plugins toc: false --- [SimpleRPCAuthorization]: /mcollective/simplerpc/authorization.html [Registration]: registration.html Fact plugins are used during discovery whenever you run the agent with queries like *-W country=de*. The default setup uses a YAML file typically stored in */etc/mcollective/facts.yaml* to read facts. There are however many fact systems like Reductive Labs Facter and Opscode Ohai or you can come up with your own. The facts plugin type lets you write code to access these tools. Facts at the moment should be simple *variable = value* style flat Hashes, if you have a hierarchical fact system like Ohai you can flatten them into *var.subvar = value* style variables. ## Details Implementing a facts plugin is made simple by inheriting from *MCollective::Facts::Base*, in that case you just need to provide 1 method, the YAML plugin code can be seen below: For releases in the 1.0.x release cycle and older, use this plugin format: {% highlight ruby linenos %} module MCollective module Facts require 'yaml' # A factsource that reads a hash of facts from a YAML file class Yaml