Sophie

Sophie

distrib > Fedora > 17 > i386 > media > updates > by-pkgid > b50d8ee6d7871fcc13c0677a9364ed59 > files > 442

bcfg2-doc-1.3.0-1.fc17.noarch.rpm



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>PuppetENC &mdash; Bcfg2 1.3.0 documentation</title>
    
    <link rel="stylesheet" href="../../../_static/default.css" type="text/css" />
    <link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
    
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '../../../',
        VERSION:     '1.3.0',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="../../../_static/jquery.js"></script>
    <script type="text/javascript" src="../../../_static/underscore.js"></script>
    <script type="text/javascript" src="../../../_static/doctools.js"></script>
    <script type="text/javascript" src="../../../_static/sidebar.js"></script>
    <link rel="shortcut icon" href="../../../_static/favicon.ico"/>
    <link rel="top" title="Bcfg2 1.3.0 documentation" href="../../../index.html" />
    <link rel="up" title="Plugins" href="../index.html" />
    <link rel="next" title="TemplateHelper" href="templatehelper.html" />
    <link rel="prev" title="Properties" href="properties.html" />
 
<link rel="stylesheet" href="../../../_static/bcfg2.css" type=""/>

  </head>
  <body>

<div style="text-align: left; padding: 10px 10px 15px 15px">
<a href="../../../index.html"><img src="../../../_static/bcfg2_logo.png" border="0" alt="sampledoc"/></a>
</div>

    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../../../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="../../../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="templatehelper.html" title="TemplateHelper"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="properties.html" title="Properties"
             accesskey="P">previous</a> |</li>
	<li><a href="../../../index.html">home</a> |&nbsp;</li>
	<!--<li><a href="../../../search.html">search</a> |&nbsp;</li>-->
	<li><a href="../../../help/index.html">help</a> |&nbsp;</li>
	<li><a href="../../../contents.html">documentation </a> &raquo;</li>

          <li><a href="../../../contents.html" >Bcfg2 documentation 1.3.0</a> &raquo;</li>
          <li><a href="../../index.html" >The Bcfg2 Server</a> &raquo;</li>
          <li><a href="../index.html" accesskey="U">Plugins</a> &raquo;</li> 
      </ul>
    </div>
  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="puppetenc">
<span id="server-plugins-connectors-puppetenc"></span><h1>PuppetENC<a class="headerlink" href="#puppetenc" title="Permalink to this headline">¶</a></h1>
<p>PuppetENC is a connector plugin that adds support for Puppet External
Node Classifiers
(<a class="reference external" href="http://docs.puppetlabs.com/guides/external_nodes.html">http://docs.puppetlabs.com/guides/external_nodes.html</a>), or ENCs.</p>
<div class="section" id="output-format">
<h2>Output Format<a class="headerlink" href="#output-format" title="Permalink to this headline">¶</a></h2>
<p>The PuppetENC plugin implements the Puppet 2.6.5+ ENC output format
with some modifications.  The basic output format is described <a class="reference external" href="http://docs.puppetlabs.com/guides/external_nodes.html#puppet-265-and-higher">here</a>.
The following modifications apply:</p>
<ul class="simple">
<li><tt class="docutils literal"><span class="pre">classes</span></tt> are considered to be Bcfg2 groups.  (This is basically
just a difference in terminology between Puppet and Bcfg2; Bcfg2
calls &#8220;groups&#8221; what Puppet calls &#8220;classes.&#8221;)</li>
<li>As an alternative to the Puppet-specific <tt class="docutils literal"><span class="pre">classes</span></tt> value, you may
use <tt class="docutils literal"><span class="pre">groups</span></tt> if you are writing an ENC from scratch specifically
for Bcfg2.</li>
<li>Since Bcfg2 does not have the notion of parameterized classes, any
class parameters provided will be merged in with the <tt class="docutils literal"><span class="pre">parameters</span></tt>
dict.</li>
<li><tt class="docutils literal"><span class="pre">parameters</span></tt> are presented as connector data.  (See Usage
below.)</li>
<li>The <tt class="docutils literal"><span class="pre">environment</span></tt> value is not supported.  If present, PuppetENC
will issue a warning and skip it.</li>
</ul>
<p>The <tt class="docutils literal"><span class="pre">parameters</span></tt> from separate ENCs are all merged together,
including parameters from any parameterized classes.  This is a
shallow merge; in other words, only the top-level keys are
considered.  For instance, assuming you had one ENC that produced:</p>
<div class="highlight-python"><pre>parameters:
    ntp_servers:
        - 0.pool.ntp.org
        - ntp1.example.com</pre>
</div>
<p>And another that produced:</p>
<div class="highlight-python"><pre>parameters:
    ntp_servers:
        - ntp2.example.com</pre>
</div>
<p>This would result in connector data that included <em>either</em> the first
value of <tt class="docutils literal"><span class="pre">ntp_servers</span></tt> <em>or</em> the second, but not both; this would
depend on the order in which the ENCs were run, which is
non-deterministic and should not be relied upon.  However, if you add
one ENC that produced:</p>
<div class="highlight-python"><pre>parameters:
    ntp_servers:
        - 0.pool.ntp.org
        - ntp1.example.com</pre>
</div>
<p>And another that produced:</p>
<div class="highlight-python"><pre>parameters:
    mail_servers:
        - mail.example.com</pre>
</div>
<p>Then the connector data would consist of:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="p">{</span><span class="s">&quot;ntp_servers&quot;</span><span class="p">:</span> <span class="p">[</span><span class="s">&quot;0.pool.ntp.org&quot;</span><span class="p">,</span> <span class="s">&quot;ntp1.example.com&quot;</span><span class="p">],</span>
 <span class="s">&quot;mail_servers&quot;</span><span class="p">:</span> <span class="p">[</span><span class="s">&quot;mail.example.com&quot;</span><span class="p">]}</span>
</pre></div>
</div>
</div>
<div class="section" id="usage">
<h2>Usage<a class="headerlink" href="#usage" title="Permalink to this headline">¶</a></h2>
<p>To use the PuppetENC plugin, first do <tt class="docutils literal"><span class="pre">mkdir</span>
<span class="pre">/var/lib/bcfg2/PuppetENC</span></tt>.  Add <tt class="docutils literal"><span class="pre">PuppetENC</span></tt> to your <tt class="docutils literal"><span class="pre">plugins</span></tt>
line in <tt class="docutils literal"><span class="pre">/etc/bcfg2.conf</span></tt>.  Now you can place any ENCs you wish to
run in <tt class="docutils literal"><span class="pre">/var/lib/bcfg2/PuppetENC</span></tt>.  Note that ENCs are run each time
client metadata is generated, so if you have a large number of ENCs or
ENCs that are very time-consuming, they could have a significant
impact on server performance.  In that case, it could be worthwhile to
write a dedicated Connector plugin.</p>
<p>PuppetENC parameters can be accessed in templates as
<tt class="docutils literal"><span class="pre">metadata.PuppetENC</span></tt>, which is a dict of all parameter data merged
together.  For instance, given the following ENC output:</p>
<div class="highlight-python"><pre>---
classes:
    common:
    puppet:
    ntp:
        ntpserver: 0.pool.ntp.org
    aptsetup:
        additional_apt_repos:
            - deb localrepo.example.com/ubuntu lucid production
            - deb localrepo.example.com/ubuntu lucid vendor
parameters:
    ntp_servers:
        - 0.pool.ntp.org
        - ntp.example.com
    mail_server: mail.example.com
    iburst: true
environment: production</pre>
</div>
<p><tt class="docutils literal"><span class="pre">metadata.PuppetENC</span></tt> would contain:</p>
<div class="highlight-python"><pre>'additional_apt_repos': ['deb localrepo.example.com/ubuntu lucid production',
 'deb localrepo.example.com/ubuntu lucid vendor'],
'iburst': True,
'mail_server': 'mail.example.com',
'ntp_servers': ['0.pool.ntp.org', 'ntp.example.com'],
'ntpserver': '0.pool.ntp.org'}</pre>
</div>
<p>(Note that the duplication of NTP server data doesn&#8217;t make this an
especially <em>good</em> example; it&#8217;s just the official Puppet example.)</p>
<p>So, in a template you could do something like:</p>
<div class="highlight-python"><pre>{% for repo in metadata.PuppetENC['additional_apt_repos'] %}\
${repo}
{% end %}\</pre>
</div>
</div>
</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
  <h3><a href="../../../index.html">Table Of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#">PuppetENC</a><ul>
<li><a class="reference internal" href="#output-format">Output Format</a></li>
<li><a class="reference internal" href="#usage">Usage</a></li>
</ul>
</li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="properties.html"
                        title="previous chapter">Properties</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="templatehelper.html"
                        title="next chapter">TemplateHelper</a></p>
  <h3>This Page</h3>
  <ul class="this-page-menu">
    <li><a href="../../../_sources/server/plugins/connectors/puppetenc.txt"
           rel="nofollow">Show Source</a></li>
  </ul>
<div id="searchbox" style="display: none">
  <h3>Quick search</h3>
    <form class="search" action="../../../search.html" method="get">
      <input type="text" name="q" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    <p class="searchtip" style="font-size: 90%">
    Enter search terms or a module, class or function name.
    </p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../../../genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="../../../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="templatehelper.html" title="TemplateHelper"
             >next</a> |</li>
        <li class="right" >
          <a href="properties.html" title="Properties"
             >previous</a> |</li>
	<li><a href="../../../index.html">home</a> |&nbsp;</li>
	<!--<li><a href="../../../search.html">search</a> |&nbsp;</li>-->
	<li><a href="../../../help/index.html">help</a> |&nbsp;</li>
	<li><a href="../../../contents.html">documentation </a> &raquo;</li>

          <li><a href="../../../contents.html" >Bcfg2 documentation 1.3.0</a> &raquo;</li>
          <li><a href="../../index.html" >The Bcfg2 Server</a> &raquo;</li>
          <li><a href="../index.html" >Plugins</a> &raquo;</li> 
      </ul>
    </div>
    <div class="footer">
        &copy; Copyright 2009-2013, Narayan Desai.
      Last updated on Mar 20, 2013.
      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3.
    </div>
  </body>
</html>