www.nico.schottelius.org/software/cdist/man/2.0.4/man7/cdist-tutorial.html

61 lines
8.3 KiB
HTML
Raw Normal View History

2011-11-18 15:03:13 +00:00
<?xml version="1.0" encoding="UTF-8"?>
<!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>cdist-tutorial(7)</title><link rel="stylesheet" type="text/css" href="docbook-xsl.css" /><meta name="generator" content="DocBook XSL Stylesheets V1.76.1" /></head><body><div xml:lang="en" class="article" title="cdist-tutorial(7)" lang="en"><div class="titlepage"><div><div><h2 class="title"><a id="id339539"></a>cdist-tutorial(7)</h2></div><div><div class="author"><h3 class="author"><span class="firstname">Nico</span> <span class="surname">Schottelius</span></h3><code class="email">&lt;<a class="email" href="mailto:nico-cdist--@--schottelius.org">nico-cdist--@--schottelius.org</a>&gt;</code></div></div></div><hr /></div><div class="toc"><p><strong>Table of Contents</strong></p><dl><dt><span class="section"><a href="#_name">1. NAME</a></span></dt><dt><span class="section"><a href="#_preparing_your_machine_setup">2. PREPARING YOUR MACHINE / SETUP</a></span></dt><dt><span class="section"><a href="#_your_first_configuration">3. YOUR FIRST CONFIGURATION</a></span></dt><dt><span class="section"><a href="#_define_state_in_the_inital_manifest">4. DEFINE STATE IN THE INITAL MANIFEST</a></span></dt><dt><span class="section"><a href="#_using_some_basic_types">5. USING SOME BASIC TYPES</a></span></dt><dt><span class="section"><a href="#_creating_your_first_own_type">6. CREATING YOUR FIRST OWN TYPE</a></span></dt><dt><span class="section"><a href="#_use_a_type_to_bundle_functionality">7. USE A TYPE TO BUNDLE FUNCTIONALITY</a></span></dt><dt><span class="section"><a href="#_using_explorers">8. USING EXPLORERS</a></span></dt><dt><span class="section"><a href="#_debugging_your_types">9. DEBUGGING YOUR TYPES</a></span></dt><dt><span class="section"><a href="#_introduction">10. INTRODUCTION</a></span></dt><dt><span class="section"><a href="#_quick_start">11. QUICK START</a></span></dt><dt><span class="section"><a href="#_see_also">12. SEE ALSO</a></span></dt></dl></div><div class="section" title="1. NAME"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_name"></a>1. NAME</h2></div></div></div><p>cdist-tutorial - a guided introduction into cdist</p></div><div class="section" title="2. PREPARING YOUR MACHINE / SETUP"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_preparing_your_machine_setup"></a>2. PREPARING YOUR MACHINE / SETUP</h2></div></div></div><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
ensure sshd is running on the target host:
</li></ul></div><p>ssh target_host</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
ensure you can login as root
</li></ul></div><p>ssh <a class="ulink" href="mailto:root@target" target="_top">root@target</a> host</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
ensure login as root works without keys
(see ssh… manpage)
</li></ul></div><p>cdist will do a lot of requests to the target
host, thus youll have to enter your password
many times, if you dont do this :-)</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
speedup processing with ControlMaster option of
ssh
</li></ul></div></div><div class="section" title="3. YOUR FIRST CONFIGURATION"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_your_first_configuration"></a>3. YOUR FIRST CONFIGURATION</h2></div></div></div></div><div class="section" title="4. DEFINE STATE IN THE INITAL MANIFEST"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_define_state_in_the_inital_manifest"></a>4. DEFINE STATE IN THE INITAL MANIFEST</h2></div></div></div><p>The initial manifest is used to map
configurations to a host.</p></div><div class="section" title="5. USING SOME BASIC TYPES"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_using_some_basic_types"></a>5. USING SOME BASIC TYPES</h2></div></div></div><p>what is a type, how to use it,</p></div><div class="section" title="6. CREATING YOUR FIRST OWN TYPE"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_creating_your_first_own_type"></a>6. CREATING YOUR FIRST OWN TYPE</h2></div></div></div><p>&lt;with object id? or signleton here already&gt;</p></div><div class="section" title="7. USE A TYPE TO BUNDLE FUNCTIONALITY"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_use_a_type_to_bundle_functionality"></a>7. USE A TYPE TO BUNDLE FUNCTIONALITY</h2></div></div></div></div><div class="section" title="8. USING EXPLORERS"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_using_explorers"></a>8. USING EXPLORERS</h2></div></div></div><p>global, type explorer</p></div><div class="section" title="9. DEBUGGING YOUR TYPES"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_debugging_your_types"></a>9. DEBUGGING YOUR TYPES</h2></div></div></div><div class="variablelist"><dl><dt><span class="term">
__debug
</span></dt><dd>
If this variable is setup, cdist runs in debug mode.
You can use this information, to only output stuff in debug
mode as well.
Available for: initial manifest, type manifest, gencode, code
</dd></dl></div></div><div class="section" title="10. INTRODUCTION"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_introduction"></a>10. INTRODUCTION</h2></div></div></div><p>This tutorial is aimed at people learning cdist and shows
typical approaches as well as gives an easy start into
the world of configuration management.</p><p>This tutorial assumes you are configuring <span class="strong"><strong>localhost</strong></span>, because
it is always available. Just repace <span class="strong"><strong>localhost</strong></span> with your target
host for real life usage.</p></div><div class="section" title="11. QUICK START"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_quick_start"></a>11. QUICK START</h2></div></div></div><p>For those who just want to configure a system with the
cdist configuration management and do not need (or want)
to understand everything.</p><p>Cdist uses <span class="strong"><strong>ssh</strong></span> for communication and transportation
and usually logs into the <span class="strong"><strong>target host</strong></span> as the
<span class="strong"><strong>root</strong></span> user. So you need to configure the <span class="strong"><strong>ssh server</strong></span>
of the target host to allow root logins: Edit
the file <span class="strong"><strong>/etc/ssh/sshd_config</strong></span> and add one of the following
lines:</p><pre class="screen"># Allow login only via public key
PermitRootLogin without-password
# Allow login via password and public key
PermitRootLogin yes</pre><p>As cdist uses ssh intensively, it is recommended to setup authentication
with public keys:</p><pre class="screen"># Generate pubkey pair as a normal user
ssh-keygen
# Copy pubkey over to target host
ssh-copy-id root@localhost</pre><p>As soon as you are able to login without passwort to the target host,
we can use cdist, to configure it. You can copy and paste the following
code into your shell to get started and configure localhost:</p><pre class="screen"># Get cdist
git clone git://git.schottelius.org/cdist
# Create manifest (maps configuration to host(s)
cd cdist
echo '__file /etc/cdist-configured' &gt; conf/manifest/init
chmod 0700 conf/manifest/init
# Configure localhost
./bin/cdist config localhost
# Find out that cdist created /etc/cdist-configured
ls -l /etc/cdist-configured</pre><p>The file <span class="emphasis"><em>conf/manifest/init</em></span> is usually the entry point for cdist,
to find out what to configure on which host. All manifests are
essentially shell scripts. Every manifest can use the types known to
cdist, which are usually underline prefixed (__).</p></div><div class="section" title="12. SEE ALSO"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_see_also"></a>12. SEE ALSO</h2></div></div></div><p>cdist(1), cdist-type(7), cdist-stages(7)</p></div></div></body></html>