Sophie

Sophie

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

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>GroupPatterns &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="Ldap" href="ldap.html" />
    <link rel="prev" title="Plugins" href="../index.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="ldap.html" title="Ldap"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="../index.html" title="Plugins"
             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="grouppatterns">
<span id="server-plugins-grouping-grouppatterns"></span><h1>GroupPatterns<a class="headerlink" href="#grouppatterns" title="Permalink to this headline">¶</a></h1>
<p>The GroupPatterns plugin is a connector that can assign clients
group membership pased on patterns in client hostnames. Two basic
methods are supported:</p>
<ul class="simple">
<li>regular expressions (NamePatterns)</li>
<li>ranges (NameRange)</li>
</ul>
<p>Hosts that match the specification are placed in the group
or groups specified by the pattern.</p>
<div class="section" id="setup">
<h2>Setup<a class="headerlink" href="#setup" title="Permalink to this headline">¶</a></h2>
<ol class="arabic simple">
<li>Enable the GroupPatterns plugin</li>
<li>Create the GroupPatterns/config.xml file (similar to the example below).</li>
<li>Client groups will be augmented based on the specification</li>
</ol>
</div>
<div class="section" id="pattern-types">
<h2>Pattern Types<a class="headerlink" href="#pattern-types" title="Permalink to this headline">¶</a></h2>
<p>NamePatterns use regular expressions to match client hostnames. All
matching clients are placed in the resulting groups. NamePatterns also
have the ability to use regular expression matched groups to dynamically
create group names. The first two examples below are NamePatterns. The
first adds client hostname to both groups <em>gp-test1</em> and <em>gp-test2</em>. The
second matches the hostname as a group and places the client in a group
called <em>group-&lt;hostname&gt;</em>.</p>
<p>NameRange patterns allow the use of the application of numeric ranges
to host names. The final pattern below matches any of <em>node1-node32</em> and
places them all into the <em>rack1</em> group. Dynamically generated group names
are not supported with NameRange.</p>
</div>
<div class="section" id="examples">
<h2>Examples<a class="headerlink" href="#examples" title="Permalink to this headline">¶</a></h2>
<div class="highlight-xml"><div class="highlight"><pre><span class="nt">&lt;GroupPatterns&gt;</span>
  <span class="nt">&lt;GroupPattern&gt;</span>
    <span class="nt">&lt;NamePattern&gt;</span>hostname<span class="nt">&lt;/NamePattern&gt;</span>
    <span class="nt">&lt;Group&gt;</span>gp-test1<span class="nt">&lt;/Group&gt;</span>
    <span class="nt">&lt;Group&gt;</span>gp-test2<span class="nt">&lt;/Group&gt;</span>
  <span class="nt">&lt;/GroupPattern&gt;</span>
  <span class="nt">&lt;GroupPattern&gt;</span>
    <span class="nt">&lt;NamePattern&gt;</span>(.*)<span class="nt">&lt;/NamePattern&gt;</span>
    <span class="nt">&lt;Group&gt;</span>group-$1&#39;<span class="nt">&lt;/Group&gt;</span>
  <span class="nt">&lt;/GroupPattern&gt;</span>
  <span class="nt">&lt;GroupPattern&gt;</span>
    <span class="nt">&lt;NameRange&gt;</span>node[[1-32]]<span class="nt">&lt;/NameRange&gt;</span>
    <span class="nt">&lt;Group&gt;</span>rack1<span class="nt">&lt;/Group&gt;</span>
  <span class="nt">&lt;/GroupPattern&gt;</span>
<span class="nt">&lt;/GroupPatterns&gt;</span>
</pre></div>
</div>
<div class="section" id="cluster-example">
<h3>Cluster Example<a class="headerlink" href="#cluster-example" title="Permalink to this headline">¶</a></h3>
<p>Functional aspects are extracted from hostname strings, and dynamic
groups are created.</p>
<p>Expected hostname to group mapping:</p>
<div class="highlight-python"><pre>xnfs1.example.com     -&gt; nfs-server
xnfs2.example.com     -&gt; nfs-server
xlogin1.example.com   -&gt; login-server
xlogin2.example.com   -&gt; login-server
xpvfs1.example.com    -&gt; pvfs-server
xpvfs2.example.com    -&gt; pvfs-server
xwww.example.com      -&gt; www-server</pre>
</div>
<p>GroupPatterns configuration:</p>
<div class="highlight-xml"><div class="highlight"><pre><span class="nt">&lt;GroupPatterns&gt;</span>
  <span class="nt">&lt;GroupPattern&gt;</span>
    <span class="nt">&lt;NamePattern&gt;</span>^x(\w[^\d|\.]+)\d*\..*<span class="nt">&lt;/NamePattern&gt;</span>
    <span class="nt">&lt;Group&gt;</span>$1-server<span class="nt">&lt;/Group&gt;</span>
  <span class="nt">&lt;/GroupPattern&gt;</span>
<span class="nt">&lt;/GroupPatterns&gt;</span>
</pre></div>
</div>
<p>Regex explanation:</p>
<ol class="arabic simple">
<li>!^x Match any hostname that begins with &#8220;x&#8221;</li>
<li>(w[!^d|.]+) followed by one or more word characters that are not a decimal digit or &#8221;.&#8221; and save the string to $1</li>
<li>d* followed by 0 or more decimal digit(s)</li>
<li>..* followed by a &#8221;.&#8221;</li>
<li>.* followed by 1 or more of anything else.</li>
</ol>
</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="#">GroupPatterns</a><ul>
<li><a class="reference internal" href="#setup">Setup</a></li>
<li><a class="reference internal" href="#pattern-types">Pattern Types</a></li>
<li><a class="reference internal" href="#examples">Examples</a><ul>
<li><a class="reference internal" href="#cluster-example">Cluster Example</a></li>
</ul>
</li>
</ul>
</li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="../index.html"
                        title="previous chapter">Plugins</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="ldap.html"
                        title="next chapter">Ldap</a></p>
  <h3>This Page</h3>
  <ul class="this-page-menu">
    <li><a href="../../../_sources/server/plugins/grouping/grouppatterns.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="ldap.html" title="Ldap"
             >next</a> |</li>
        <li class="right" >
          <a href="../index.html" title="Plugins"
             >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>