www.nico.schottelius.org/software/cdist/man/beta/cdist-bootstrap.html

356 lines
18 KiB
HTML
Raw Normal View History

2016-11-27 15:32:05 +00:00
<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
2019-01-25 15:18:27 +00:00
<title>11. Bootstrap &mdash; cdist 4.10.5-270-g0dc94fb5 documentation</title>
2016-11-27 15:32:05 +00:00
2017-06-13 20:40:23 +00:00
2016-11-27 15:32:05 +00:00
2019-01-25 15:18:27 +00:00
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="12. Configuration" href="cdist-configuration.html" />
<link rel="prev" title="10. cdist(1)" href="man1/cdist.html" />
2016-11-27 15:32:05 +00:00
<script src="_static/js/modernizr.min.js"></script>
</head>
2019-01-25 15:18:27 +00:00
<body class="wy-body-for-nav">
2016-11-27 15:32:05 +00:00
2017-06-13 20:40:23 +00:00
2016-11-27 15:32:05 +00:00
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search">
<a href="index.html" class="icon icon-home"> cdist
</a>
<div class="version">
2019-01-25 15:18:27 +00:00
4.10.5-270-g0dc94fb5
2016-11-27 15:32:05 +00:00
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
2017-06-13 20:40:23 +00:00
<ul class="current">
2016-11-27 15:32:05 +00:00
<li class="toctree-l1"><a class="reference internal" href="cdist-intro.html">1. cdist - usable configuration management</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-why.html">2. Why should I use cdist?</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-os.html">3. Supported Operating Systems</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-install.html">4. How to install cdist</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-update.html">5. How to update cdist</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-support.html">6. Support</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-features.html">7. Features</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-quickstart.html">8. Quickstart</a></li>
2019-01-25 15:18:27 +00:00
<li class="toctree-l1"><a class="reference internal" href="cdist-real-world.html">9. Dive into real world cdist</a></li>
<li class="toctree-l1"><a class="reference internal" href="man1/cdist.html">10. cdist(1)</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">11. Bootstrap</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#location">11.1. Location</a></li>
<li class="toctree-l2"><a class="reference internal" href="#setup-working-directory-and-branch">11.2. Setup working directory and branch</a></li>
<li class="toctree-l2"><a class="reference internal" href="#publishing-the-configuration">11.3. Publishing the configuration</a></li>
<li class="toctree-l2"><a class="reference internal" href="#updating-from-origin">11.4. Updating from origin</a></li>
2016-11-27 15:32:05 +00:00
</ul>
</li>
2019-01-25 15:18:27 +00:00
<li class="toctree-l1"><a class="reference internal" href="cdist-configuration.html">12. Configuration</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-manifest.html">13. Manifest</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-type.html">14. cdist type</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-types.html">15. cdist types</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-explorer.html">16. Explorer</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-messaging.html">17. Messaging</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-parallelization.html">18. Parallelization</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-inventory.html">19. Inventory</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-trigger.html">20. Trigger</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-preos.html">21. PreOS</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-integration.html">22. cdist integration / using cdist as library</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-reference.html">23. Reference</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-best-practice.html">24. Best practice</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-stages.html">25. Execution stages</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-cache.html">26. Local cache overview</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-saving-output-streams.html">27. Saving output streams</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-remote-exec-copy.html">28. Remote exec and copy commands</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-hacker.html">29. Hacking</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-troubleshooting.html">30. Troubleshooting</a></li>
2016-11-27 15:32:05 +00:00
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
2019-01-25 15:18:27 +00:00
<nav class="wy-nav-top" aria-label="top navigation">
2017-06-13 20:40:23 +00:00
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="index.html">cdist</a>
2016-11-27 15:32:05 +00:00
</nav>
<div class="wy-nav-content">
2019-01-25 15:18:27 +00:00
2016-11-27 15:32:05 +00:00
<div class="rst-content">
2019-01-25 15:18:27 +00:00
2016-11-27 15:32:05 +00:00
2017-06-13 20:40:23 +00:00
2016-11-27 15:32:05 +00:00
<div role="navigation" aria-label="breadcrumbs navigation">
2017-06-13 20:40:23 +00:00
2016-11-27 15:32:05 +00:00
<ul class="wy-breadcrumbs">
2017-06-13 20:40:23 +00:00
<li><a href="index.html">Docs</a> &raquo;</li>
2019-01-25 15:18:27 +00:00
<li>11. Bootstrap</li>
2017-06-13 20:40:23 +00:00
2016-11-27 15:32:05 +00:00
<li class="wy-breadcrumbs-aside">
2017-06-13 20:40:23 +00:00
<a href="_sources/cdist-bootstrap.rst.txt" rel="nofollow"> View page source</a>
2016-11-27 15:32:05 +00:00
</li>
2017-06-13 20:40:23 +00:00
2016-11-27 15:32:05 +00:00
</ul>
2017-06-13 20:40:23 +00:00
2016-11-27 15:32:05 +00:00
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<div class="section" id="bootstrap">
2019-01-25 15:18:27 +00:00
<h1>11. Bootstrap<a class="headerlink" href="#bootstrap" title="Permalink to this headline"></a></h1>
2016-11-27 15:32:05 +00:00
<p>This document describes the usual steps recommended for a new
cdist setup. It is recommended that you have read and understood
<a class="reference external" href="cdist-quickstart.html">cdist quickstart</a> before digging into this.</p>
<div class="section" id="location">
2019-01-25 15:18:27 +00:00
<h2>11.1. Location<a class="headerlink" href="#location" title="Permalink to this headline"></a></h2>
2016-11-27 15:32:05 +00:00
<p>First of all, you should think about where to store your configuration
database and who will be accessing or changing it. Secondly you have to
think about where to configure your hosts from, which may be a different
location.</p>
<p>For starters, having cdist (which includes the configuration database) on
your notebook should be fine.
Additionally an external copy of the git repository the configuration
relies on is recommended, for use as backup as well as to allow easy collaboration
with others.</p>
<p>For more sophisticated setups developing cdist configurations with multiple
people, have a look at <a class="reference external" href="cdist-best-practice.html">cdist best practice</a>.</p>
</div>
<div class="section" id="setup-working-directory-and-branch">
2019-01-25 15:18:27 +00:00
<h2>11.2. Setup working directory and branch<a class="headerlink" href="#setup-working-directory-and-branch" title="Permalink to this headline"></a></h2>
2016-11-27 15:32:05 +00:00
<p>I assume you have a fresh copy of the cdist tree in ~/cdist, cloned from
one of the official urls (see <a class="reference external" href="cdist-quickstart.html">cdist quickstart</a> if you don't).
Entering the command &quot;git branch&quot; should show you &quot;* master&quot;, which indicates
you are on the <strong>master</strong> branch.</p>
<p>The master branch reflects the latest development of cdist. As this is the
development branch, it may or may not work. There are also version branches
available, which are kept in a stable state. Let's use <strong>git branch -r</strong>
to list all branches:</p>
2019-01-25 15:18:27 +00:00
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">cdist</span><span class="o">%</span> <span class="n">git</span> <span class="n">branch</span> <span class="o">-</span><span class="n">r</span>
2016-11-27 15:32:05 +00:00
<span class="n">origin</span><span class="o">/</span><span class="mf">1.0</span>
<span class="n">origin</span><span class="o">/</span><span class="mf">1.1</span>
<span class="n">origin</span><span class="o">/</span><span class="mf">1.2</span>
<span class="n">origin</span><span class="o">/</span><span class="mf">1.3</span>
<span class="n">origin</span><span class="o">/</span><span class="mf">1.4</span>
<span class="n">origin</span><span class="o">/</span><span class="mf">1.5</span>
<span class="n">origin</span><span class="o">/</span><span class="mf">1.6</span>
<span class="n">origin</span><span class="o">/</span><span class="mf">1.7</span>
<span class="n">origin</span><span class="o">/</span><span class="mf">2.0</span>
<span class="n">origin</span><span class="o">/</span><span class="n">HEAD</span> <span class="o">-&gt;</span> <span class="n">origin</span><span class="o">/</span><span class="n">master</span>
<span class="n">origin</span><span class="o">/</span><span class="n">archive_shell_function_approach</span>
<span class="n">origin</span><span class="o">/</span><span class="n">master</span>
</pre></div>
</div>
<p>So <strong>2.0</strong> is the latest version branch in this example.
All versions (2.0.x) within one version branch (2.0) are compatible to each
other and won't break your configuration when updating.</p>
<p>It's up to you to decide which branch you want to base your own work on:
master contains more recent changes, newer types, but may also break.
The version branches are stable, but may lack the latest features.
Your decision can be changed later on, but may result in merge conflicts,
which you will need to solve.</p>
<p>Let's assume you want latest stuff and select the master branch as base for
your own work. Now it's time to create your branch, which contains your
local changes. I usually name it by the company/area I am working for:
ethz-systems, localch, customerX, ... But this is pretty much up to you.</p>
<p>In this tutorial I use the branch <strong>mycompany</strong>:</p>
2019-01-25 15:18:27 +00:00
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">cdist</span><span class="o">%</span> <span class="n">git</span> <span class="n">checkout</span> <span class="o">-</span><span class="n">b</span> <span class="n">mycompany</span> <span class="n">origin</span><span class="o">/</span><span class="n">master</span>
2016-11-27 15:32:05 +00:00
<span class="n">Branch</span> <span class="n">mycompany</span> <span class="nb">set</span> <span class="n">up</span> <span class="n">to</span> <span class="n">track</span> <span class="n">remote</span> <span class="n">branch</span> <span class="n">master</span> <span class="kn">from</span> <span class="nn">origin.</span>
<span class="n">Switched</span> <span class="n">to</span> <span class="n">a</span> <span class="n">new</span> <span class="n">branch</span> <span class="s1">&#39;mycompany&#39;</span>
<span class="n">cdist</span><span class="o">-</span><span class="n">user</span><span class="o">%</span> <span class="n">git</span> <span class="n">branch</span>
<span class="n">master</span>
<span class="o">*</span> <span class="n">mycompany</span>
</pre></div>
</div>
<p>From now on, you can use git as usual to commit your changes in your own branch.</p>
</div>
<div class="section" id="publishing-the-configuration">
2019-01-25 15:18:27 +00:00
<h2>11.3. Publishing the configuration<a class="headerlink" href="#publishing-the-configuration" title="Permalink to this headline"></a></h2>
2016-11-27 15:32:05 +00:00
<p>Usually a development machine like a notebook should be considered
temporary only. For this reason and to enable shareability, the configuration
should be published to another device as early as possible. The following
example shows how to publish the configuration to another host that is
reachable via ssh and has git installed:</p>
2019-01-25 15:18:27 +00:00
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1"># Create bare git repository on the host named &quot;loch&quot;</span>
2016-11-27 15:32:05 +00:00
<span class="n">cdist</span><span class="o">%</span> <span class="n">ssh</span> <span class="n">loch</span> <span class="s2">&quot;GIT_DIR=/home/nutzer/cdist git init&quot;</span>
<span class="n">Initialized</span> <span class="n">empty</span> <span class="n">Git</span> <span class="n">repository</span> <span class="ow">in</span> <span class="o">/</span><span class="n">home</span><span class="o">/</span><span class="n">nutzer</span><span class="o">/</span><span class="n">cdist</span><span class="o">/</span>
<span class="c1"># Add remote git repo to git config</span>
<span class="n">cdist</span><span class="o">%</span> <span class="n">git</span> <span class="n">remote</span> <span class="n">add</span> <span class="n">loch</span> <span class="n">loch</span><span class="p">:</span><span class="o">/</span><span class="n">home</span><span class="o">/</span><span class="n">nutzer</span><span class="o">/</span><span class="n">cdist</span>
<span class="c1"># Configure the mycompany branch to push to loch</span>
<span class="n">cdist</span><span class="o">%</span> <span class="n">git</span> <span class="n">config</span> <span class="n">branch</span><span class="o">.</span><span class="n">mycompany</span><span class="o">.</span><span class="n">remote</span> <span class="n">loch</span>
<span class="c1"># Configure mycompany branch to push into remote master branch</span>
<span class="n">cdist</span><span class="o">%</span> <span class="n">git</span> <span class="n">config</span> <span class="n">branch</span><span class="o">.</span><span class="n">mycompany</span><span class="o">.</span><span class="n">merge</span> <span class="n">refs</span><span class="o">/</span><span class="n">heads</span><span class="o">/</span><span class="n">master</span>
<span class="c1"># Push mycompany branch to remote branch master initially</span>
<span class="n">cdist</span><span class="o">%</span> <span class="n">git</span> <span class="n">push</span> <span class="n">loch</span> <span class="n">mycompany</span><span class="p">:</span><span class="n">refs</span><span class="o">/</span><span class="n">heads</span><span class="o">/</span><span class="n">master</span>
</pre></div>
</div>
<p>Now you have setup the git repository to synchronise the <strong>mycompany</strong>
branch with the <strong>master</strong> branch on the host <strong>loch</strong>. Thus you can commit
as usual in your branch and push out changes by entering <strong>git push</strong>.</p>
</div>
<div class="section" id="updating-from-origin">
2019-01-25 15:18:27 +00:00
<h2>11.4. Updating from origin<a class="headerlink" href="#updating-from-origin" title="Permalink to this headline"></a></h2>
2016-11-27 15:32:05 +00:00
<p>Whenever you want to update your cdist installation, you can use git to do so:</p>
2019-01-25 15:18:27 +00:00
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1"># Update git repository with latest changes from origin</span>
2016-11-27 15:32:05 +00:00
<span class="n">cdist</span><span class="o">%</span> <span class="n">git</span> <span class="n">fetch</span> <span class="n">origin</span>
<span class="c1"># Update current branch with master branch from origin</span>
<span class="n">cdist</span><span class="o">%</span> <span class="n">git</span> <span class="n">merge</span> <span class="n">origin</span><span class="o">/</span><span class="n">master</span>
<span class="c1"># Alternative: Update current branch with 2.0 branch from origin</span>
<span class="n">cdist</span><span class="o">%</span> <span class="n">git</span> <span class="n">merge</span> <span class="n">origin</span><span class="o">/</span><span class="mf">2.0</span>
</pre></div>
</div>
</div>
</div>
2017-06-13 20:40:23 +00:00
</div>
2019-01-25 15:18:27 +00:00
2016-11-27 15:32:05 +00:00
</div>
<footer>
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
2019-01-25 15:18:27 +00:00
<a href="cdist-configuration.html" class="btn btn-neutral float-right" title="12. Configuration" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
2016-11-27 15:32:05 +00:00
2019-01-25 15:18:27 +00:00
<a href="man1/cdist.html" class="btn btn-neutral" title="10. cdist(1)" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
2016-11-27 15:32:05 +00:00
</div>
<hr/>
<div role="contentinfo">
<p>
2019-01-25 15:18:27 +00:00
&copy; Copyright
2016-11-27 15:32:05 +00:00
</p>
</div>
2019-01-25 15:18:27 +00:00
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
2016-11-27 15:32:05 +00:00
</footer>
</div>
</div>
</section>
</div>
2019-01-25 15:18:27 +00:00
<script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></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 async="async" type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
2016-11-27 15:32:05 +00:00
2019-01-25 15:18:27 +00:00
<script type="text/javascript" src="_static/js/theme.js"></script>
2016-11-27 15:32:05 +00:00
<script type="text/javascript">
jQuery(function () {
2019-01-25 15:18:27 +00:00
SphinxRtdTheme.Navigation.enable(true);
2016-11-27 15:32:05 +00:00
});
2019-01-25 15:18:27 +00:00
</script>
2016-11-27 15:32:05 +00:00
</body>
</html>