Sophie

Sophie

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

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>clients.xml &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="TGenshi" href="../../tgenshi.html" />
    <link rel="next" title="ganglia" href="ganglia.html" />
    <link rel="prev" title="bcfg2-cron" href="bcfg2-cron.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="ganglia.html" title="ganglia"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="bcfg2-cron.html" title="bcfg2-cron"
             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" >Plugins</a> &raquo;</li>
          <li><a href="../../tgenshi.html" accesskey="U">TGenshi</a> &raquo;</li> 
      </ul>
    </div>
  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="clients-xml">
<h1>clients.xml<a class="headerlink" href="#clients-xml" title="Permalink to this headline">ΒΆ</a></h1>
<p>As submitted by dclark</p>
<p>Here is an example of maintaining the bcfg2 server&#8217;s
<tt class="docutils literal"><span class="pre">/var/lib/bcfg2/Metadata/clients.xml</span></tt> file using Genshi templates.</p>
<p>There are two main advantages:</p>
<ol class="arabic simple">
<li>Password storage is centralized in the <tt class="docutils literal"><span class="pre">Properties/passwords.xml</span></tt>
file this helps maintain consistency, makes changing passwords
easier, and also makes it easier to share your configurations with
other sites/people.</li>
<li>You can template the file using Genshi&#8217;s <cite>{% def %}</cite> syntax,
which makes <cite>clients.xml</cite> much more readable. An important
thing to note is how the <cite>name</cite> variable is handled - when
just referring to it the standard <cite>${name}</cite> syntax is used, but
when it is used as a variable in the expression to get the password,
<cite>password=&#8221;${metadata.Properties[&#8216;passwords.xml&#8217;].xdata.find(&#8216;password&#8217;).find(&#8216;bcfg2-client&#8217;).find(name).text}&#8221;</cite>,
it is just referred to as <cite>name</cite>.</li>
</ol>
<p>There is the disadvantage that sometimes 2 passes will be needed to get
to a consistent state.</p>
<p>Possible improvements:</p>
<ol class="arabic simple">
<li>Wrapper for bcfg2 client runs on the bcfg2 server, perhaps using a call
to <cite>bcfg2-info buildfile</cite>, so clients.xml is always generated before
everything else happens (since the state of clients.xml can influence
everything else bcfg2-server does).</li>
<li>We really don&#8217;t care what the client passwords are, just that they
exist, so instead of listing them a master password combined with
some kind of one-way hash based on the <cite>name</cite> might make more sense,
and make <tt class="docutils literal"><span class="pre">Properties/passwords.xml</span></tt> easier to maintain.</li>
</ol>
<blockquote>
<div><ul>
<li><p class="first">Cfg/var/lib/bcfg2/Metadata/clients.xml/clients.xml.genshi:</p>
<div class="highlight-xml"><div class="highlight"><pre><span class="c">&lt;!-- Do not edit this file directly - edit only the above template --&gt;</span>

{# Doc: http://bcfg2.org/wiki/Authentication #}\
{% def static(profile,name,address) %}
    <span class="nt">&lt;Client</span>
        <span class="na">profile=</span><span class="s">&quot;${profile}&quot;</span>
        <span class="na">name=</span><span class="s">&quot;${name}&quot;</span>
        <span class="na">uuid=</span><span class="s">&quot;${name}&quot;</span>
        <span class="na">password=</span><span class="s">&quot;${metadata.Properties[&#39;passwords.xml&#39;].xdata.find(&#39;password&#39;).find(&#39;bcfg2-client&#39;).find(name).text}&quot;</span>
        <span class="na">address=</span><span class="s">&quot;${address}&quot;</span>
        <span class="na">location=</span><span class="s">&quot;fixed&quot;</span>
        <span class="na">secure=</span><span class="s">&quot;true&quot;</span>
    <span class="nt">/&gt;</span>\
{% end %}\
{% def dynamic(profile,name) %}
    <span class="nt">&lt;Client</span>
        <span class="na">profile=</span><span class="s">&quot;${profile}&quot;</span>
        <span class="na">name=</span><span class="s">&quot;${name}&quot;</span>
        <span class="na">uuid=</span><span class="s">&quot;${name}&quot;</span>
        <span class="na">password=</span><span class="s">&quot;${metadata.Properties[&#39;passwords.xml&#39;].xdata.find(&#39;password&#39;).find(&#39;bcfg2-client&#39;).find(name).text}&quot;</span>
        <span class="na">floating=</span><span class="s">&quot;true&quot;</span>
        <span class="na">secure=</span><span class="s">&quot;true&quot;</span>
    <span class="nt">/&gt;</span>\
{% end %}\
<span class="nt">&lt;Clients</span> <span class="na">version=</span><span class="s">&quot;3.0&quot;</span><span class="nt">&gt;</span>\
    ${static(&#39;group-server-collab&#39;,&#39;campaigns.example.com&#39;,&#39;192.168.111.1&#39;)}
    ${static(&#39;group-server-collab&#39;,&#39;info.office.example.com&#39;,&#39;192.168.111.2&#39;)}
    ${static(&#39;group-server-config&#39;,&#39;config.example.com&#39;,&#39;192.168.111.3&#39;)}
    ${dynamic(&#39;group-project-membercard&#39;,&#39;membercard&#39;)}
    ${dynamic(&#39;group-person-somename&#39;,&#39;somename.office.example.com&#39;)}
<span class="nt">&lt;/Clients&gt;</span>
</pre></div>
</div>
</li>
<li><p class="first">Properties/passwords.xml snippit:</p>
<div class="highlight-xml"><div class="highlight"><pre><span class="nt">&lt;Properties&gt;</span>
        <span class="nt">&lt;password&gt;</span>
                <span class="nt">&lt;bcfg2-client&gt;</span>
                        <span class="nt">&lt;campaigns.example.com&gt;</span>FAKEpassword1<span class="nt">&lt;/campaigns.example.com&gt;</span>
                        <span class="nt">&lt;info.office.example.com&gt;</span>FAKEpassword2<span class="nt">&lt;/info.office.example.com&gt;</span>
                        <span class="nt">&lt;config.example.com&gt;</span>FAKEpassword3<span class="nt">&lt;/config.example.com&gt;</span>
                        <span class="nt">&lt;membercard&gt;</span>FAKEpassword4<span class="nt">&lt;/membercard&gt;</span>
                        <span class="nt">&lt;somename.office.example.com&gt;</span>FAKEpassword5<span class="nt">&lt;/somename.office.example.com&gt;</span>
                <span class="nt">&lt;/bcfg2-client&gt;</span>
        <span class="nt">&lt;/password&gt;</span>
<span class="nt">&lt;/Properties&gt;</span>
</pre></div>
</div>
</li>
</ul>
</div></blockquote>
</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
  <h4>Previous topic</h4>
  <p class="topless"><a href="bcfg2-cron.html"
                        title="previous chapter">bcfg2-cron</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="ganglia.html"
                        title="next chapter">ganglia</a></p>
  <h3>This Page</h3>
  <ul class="this-page-menu">
    <li><a href="../../../../../_sources/server/plugins/generators/examples/genshi/clientsxml.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="ganglia.html" title="ganglia"
             >next</a> |</li>
        <li class="right" >
          <a href="bcfg2-cron.html" title="bcfg2-cron"
             >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>
          <li><a href="../../tgenshi.html" >TGenshi</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>