Sophie

Sophie

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

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>ntp example &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="Example files" href="../files.html" />
    <link rel="next" title="Example configuration" href="../configuration.html" />
    <link rel="prev" title="MySQL example" href="mysql.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="../configuration.html" title="Example configuration"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="mysql.html" title="MySQL example"
             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" >Appendix</a> &raquo;</li>
          <li><a href="../files.html" accesskey="U">Example files</a> &raquo;</li> 
      </ul>
    </div>
  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <span class="target" id="appendix-files-ntp"></span><div class="section" id="ntp-example">
<h1>ntp example<a class="headerlink" href="#ntp-example" title="Permalink to this headline">¶</a></h1>
<p>Here is a series of example configurations for Bcfg2, each introducing
another layer of functionality.</p>
<ul class="simple">
<li>After each change, run <tt class="docutils literal"><span class="pre">bcfg-repo-validate</span> <span class="pre">-v</span></tt></li>
<li>Run the server with <tt class="docutils literal"><span class="pre">bcfg2-server</span> <span class="pre">-v</span></tt></li>
<li>Update the client with <tt class="docutils literal"><span class="pre">bcfg2</span> <span class="pre">-v</span> <span class="pre">-d</span> <span class="pre">-n</span></tt> (will not actually make
client changes)</li>
</ul>
<div class="section" id="package-only">
<h2>Package only<a class="headerlink" href="#package-only" title="Permalink to this headline">¶</a></h2>
<p>Our example starts with the bare minimum configuration setup. We have
a client, a profile group, a list of packages, and an NTP bundle.</p>
<p><tt class="docutils literal"><span class="pre">Metadata/clients.xml</span></tt>:</p>
<div class="highlight-xml"><div class="highlight"><pre><span class="nt">&lt;Clients&gt;</span>
  <span class="nt">&lt;Client</span> <span class="na">profile=</span><span class="s">&#39;server&#39;</span> <span class="na">name=</span><span class="s">&#39;foo.bar.com&#39;</span><span class="nt">/&gt;</span>
<span class="nt">&lt;/Clients&gt;</span>
</pre></div>
</div>
<p><tt class="docutils literal"><span class="pre">Metadata/groups.xml</span></tt>:</p>
<div class="highlight-xml"><div class="highlight"><pre><span class="nt">&lt;Groups&gt;</span>
  <span class="nt">&lt;Group</span> <span class="na">profile=</span><span class="s">&#39;true&#39;</span> <span class="na">name=</span><span class="s">&#39;server&#39;</span><span class="nt">&gt;</span>
    <span class="nt">&lt;Bundle</span> <span class="na">name=</span><span class="s">&quot;ntp&quot;</span><span class="nt">/&gt;</span>
  <span class="nt">&lt;/Group&gt;</span>
<span class="nt">&lt;/Groups&gt;</span>
</pre></div>
</div>
<p><tt class="docutils literal"><span class="pre">Bundler/ntp.xml</span></tt>:</p>
<div class="highlight-xml"><div class="highlight"><pre><span class="nt">&lt;Bundle</span> <span class="na">name=</span><span class="s">&quot;ntp&quot;</span><span class="nt">&gt;</span>
  <span class="nt">&lt;Package</span> <span class="na">name=</span><span class="s">&#39;ntp&#39;</span><span class="nt">/&gt;</span>
<span class="nt">&lt;/Bundle&gt;</span>
</pre></div>
</div>
<p><tt class="docutils literal"><span class="pre">Pkgmgr/packages.xml</span></tt>:</p>
<div class="highlight-xml"><div class="highlight"><pre><span class="nt">&lt;PackageList</span> <span class="na">type=</span><span class="s">&#39;rpm&#39;</span> <span class="na">priority=</span><span class="s">&#39;0&#39;</span><span class="nt">&gt;</span>
  <span class="nt">&lt;Package</span> <span class="na">name=</span><span class="s">&#39;ntp&#39;</span> <span class="na">version=</span><span class="s">&#39;4.2.0.a.20050816-11.FC5&#39;</span><span class="nt">/&gt;</span>
<span class="nt">&lt;/PackageList&gt;</span>
</pre></div>
</div>
<p>(This can also be performed more elegantly with the
<a class="reference internal" href="../../server/plugins/generators/packages.html#server-plugins-generators-packages"><em>Packages</em></a> plugin.)</p>
</div>
<div class="section" id="add-service">
<h2>Add service<a class="headerlink" href="#add-service" title="Permalink to this headline">¶</a></h2>
<p>Configure the service, and add it to Rules.</p>
<p><tt class="docutils literal"><span class="pre">Rules/services.xml</span></tt>:</p>
<div class="highlight-xml"><div class="highlight"><pre><span class="nt">&lt;Services</span> <span class="na">priority=</span><span class="s">&#39;0&#39;</span><span class="nt">&gt;</span>
  <span class="nt">&lt;Service</span> <span class="na">name=</span><span class="s">&#39;ntpd&#39;</span> <span class="na">status=</span><span class="s">&#39;on&#39;</span><span class="nt">/&gt;</span>
<span class="nt">&lt;/Services&gt;</span>
</pre></div>
</div>
<p><tt class="docutils literal"><span class="pre">Bundler/ntp.xml</span></tt>:</p>
<div class="highlight-xml"><div class="highlight"><pre><span class="nt">&lt;Bundle</span> <span class="na">name=</span><span class="s">&quot;ntp&quot;</span><span class="nt">&gt;</span>
  <span class="nt">&lt;Package</span> <span class="na">name=</span><span class="s">&#39;ntp&#39;</span><span class="nt">/&gt;</span>
  <span class="nt">&lt;Service</span> <span class="na">name=</span><span class="s">&#39;ntpd&#39;</span><span class="nt">/&gt;</span>
<span class="nt">&lt;/Bundle&gt;</span>
</pre></div>
</div>
</div>
<div class="section" id="add-config-file">
<h2>Add config file<a class="headerlink" href="#add-config-file" title="Permalink to this headline">¶</a></h2>
<p>Setup an <tt class="docutils literal"><span class="pre">etc/</span></tt> directory structure, and add it to the base:</p>
<div class="highlight-python"><pre># cat Cfg/etc/ntp.conf/ntp.conf
server ntp1.utexas.edu</pre>
</div>
<p><tt class="docutils literal"><span class="pre">Base/base.xml</span></tt>:</p>
<p><tt class="docutils literal"><span class="pre">Bundler/ntp.xml</span></tt>:</p>
<div class="highlight-xml"><div class="highlight"><pre><span class="nt">&lt;Bundle</span> <span class="na">name=</span><span class="s">&quot;ntp&quot;</span><span class="nt">&gt;</span>
  <span class="nt">&lt;Package</span> <span class="na">name=</span><span class="s">&#39;ntp&#39;</span><span class="nt">/&gt;</span>
  <span class="nt">&lt;Service</span> <span class="na">name=</span><span class="s">&#39;ntpd&#39;</span><span class="nt">/&gt;</span>
   <span class="nt">&lt;Path</span> <span class="na">name=</span><span class="s">&#39;/etc/ntp.conf&#39;</span><span class="nt">/&gt;</span>
<span class="nt">&lt;/Bundle&gt;</span>
</pre></div>
</div>
</div>
<div class="section" id="create-a-bundle">
<h2>Create a bundle<a class="headerlink" href="#create-a-bundle" title="Permalink to this headline">¶</a></h2>
<p>Bundles allow the grouping of related configuration entries that are
used to provide a single service. This is done for several reasons:</p>
<ul class="simple">
<li>Grouping related things in one place makes it easier to add those
entries for multiple groups of clients</li>
<li>Grouping entries into bundles makes their validation occur
collectively. This means that config files can override the
contents of packages. Also, config files are rechecked after
packages are upgraded, so that they can be repaired if the
package install clobbered them.</li>
<li>Services associated with a bundle get restarted whenever any entity
in that bundle is modified. This ensures that new configuration
files and software are used after installation.</li>
</ul>
<p>The config file, package, and service are really all related
components describing the idea of an ntp client, so they should be
logically grouped together. We use a bundle to accomplish this.</p>
<p><tt class="docutils literal"><span class="pre">Bundler/ntp.xml</span></tt>:</p>
<div class="highlight-xml"><div class="highlight"><pre><span class="nt">&lt;Bundle</span> <span class="na">name=</span><span class="s">&#39;ntp&#39;</span><span class="nt">&gt;</span>
  <span class="nt">&lt;Package</span> <span class="na">name=</span><span class="s">&#39;ntp&#39;</span><span class="nt">/&gt;</span>
  <span class="nt">&lt;Service</span> <span class="na">name=</span><span class="s">&#39;ntpd&#39;</span><span class="nt">/&gt;</span>
  <span class="nt">&lt;Path</span> <span class="na">name=</span><span class="s">&#39;/etc/ntp.conf&#39;</span><span class="nt">/&gt;</span>
<span class="nt">&lt;/Bundle&gt;</span>
</pre></div>
</div>
<p>After this bundle is created, it must be associated with a group
(or groups). Add a bundle child element to the group(s) which should
install this bundle.</p>
<p><tt class="docutils literal"><span class="pre">Metadata/groups.xml</span></tt>:</p>
<div class="highlight-xml"><div class="highlight"><pre><span class="nt">&lt;Groups&gt;</span>
 ...
 <span class="nt">&lt;Group</span> <span class="na">profile=</span><span class="s">&#39;true&#39;</span> <span class="na">name=</span><span class="s">&#39;server&#39;</span><span class="nt">&gt;</span>
   <span class="nt">&lt;Bundle</span> <span class="na">name=</span><span class="s">&quot;ntp&quot;</span><span class="nt">/&gt;</span>
 <span class="nt">&lt;/Group&gt;</span>
 ...
<span class="nt">&lt;/Groups&gt;</span>
</pre></div>
</div>
<p>Once this bundle is created, a client reconfigure will install these
entries. If any are modified, then the <em>ntpd</em> service will be
restarted. If you only want ntp configurations to be updated (and
nothing else), the bcfg2 client can be run with a <tt class="docutils literal"><span class="pre">-b</span> <span class="pre">&lt;bundle</span> <span class="pre">name&gt;</span></tt>
option that will only update entries in the specified bundle.</p>
</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="#">ntp example</a><ul>
<li><a class="reference internal" href="#package-only">Package only</a></li>
<li><a class="reference internal" href="#add-service">Add service</a></li>
<li><a class="reference internal" href="#add-config-file">Add config file</a></li>
<li><a class="reference internal" href="#create-a-bundle">Create a bundle</a></li>
</ul>
</li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="mysql.html"
                        title="previous chapter">MySQL example</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="../configuration.html"
                        title="next chapter">Example configuration</a></p>
  <h3>This Page</h3>
  <ul class="this-page-menu">
    <li><a href="../../_sources/appendix/files/ntp.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="../configuration.html" title="Example configuration"
             >next</a> |</li>
        <li class="right" >
          <a href="mysql.html" title="MySQL example"
             >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" >Appendix</a> &raquo;</li>
          <li><a href="../files.html" >Example files</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>