| 1 |
Quickstart |
| 2 |
========== |
| 3 |
|
| 4 |
This tutorial is aimed at people learning cdist and shows |
| 5 |
typical approaches as well as gives an easy start into |
| 6 |
the world of configuration management. |
| 7 |
|
| 8 |
For those who just want to configure a system with the |
| 9 |
cdist configuration management and do not need (or want) |
| 10 |
to understand everything. |
| 11 |
|
| 12 |
This tutorial assumes you are configuring **localhost**, because |
| 13 |
it is always available. Just replace **localhost** with your target |
| 14 |
host for real life usage. |
| 15 |
|
| 16 |
Cdist uses **ssh** for communication and transportation |
| 17 |
and usually logs into the **target host** as the |
| 18 |
**root** user. So you need to configure the **ssh server** |
| 19 |
of the target host to allow root logins: Edit |
| 20 |
the file **/etc/ssh/sshd_config** and add one of the following |
| 21 |
lines:: |
| 22 |
|
| 23 |
# Allow login only via public key |
| 24 |
PermitRootLogin without-password |
| 25 |
|
| 26 |
# Allow login via password and public key |
| 27 |
PermitRootLogin yes |
| 28 |
|
| 29 |
As cdist uses ssh intensively, it is recommended to setup authentication |
| 30 |
with public keys:: |
| 31 |
|
| 32 |
# Generate pubkey pair as a normal user |
| 33 |
ssh-keygen |
| 34 |
|
| 35 |
# Copy pubkey over to target host |
| 36 |
ssh-copy-id root@localhost |
| 37 |
|
| 38 |
Have a look at ssh-agent(1) and ssh-add(1) on how to cache the password for |
| 39 |
your public key. Usually it looks like this:: |
| 40 |
|
| 41 |
# Start agent and export variables |
| 42 |
eval `ssh-agent` |
| 43 |
|
| 44 |
# Add keys (requires password for every identity file) |
| 45 |
ssh-add |
| 46 |
|
| 47 |
At this point you should be able to **ssh root@localhost** without |
| 48 |
re-entering the password. If something failed until here, ensure that |
| 49 |
all steps went successfully and you have read and understood the |
| 50 |
documentation. |
| 51 |
|
| 52 |
As soon as you are able to login without password to localhost, |
| 53 |
we can use cdist to configure it. You can copy and paste the following |
| 54 |
code into your shell to get started and configure localhost:: |
| 55 |
|
| 56 |
# Get cdist |
| 57 |
git clone [email protected]:ungleich-public/cdist.git |
| 58 |
|
| 59 |
# Create manifest (maps configuration to host(s) |
| 60 |
cd cdist |
| 61 |
echo '__file /etc/cdist-configured' > cdist/conf/manifest/init |
| 62 |
|
| 63 |
# Configure localhost in verbose mode |
| 64 |
./bin/cdist config -v localhost |
| 65 |
|
| 66 |
# Find out that cdist created /etc/cdist-configured |
| 67 |
ls -l /etc/cdist-configured |
| 68 |
|
| 69 |
Note: cdist/conf is configuration directory shipped with cdist distribution. |
| 70 |
If exists, ~/.cdist, is also automatically used as cdist configuration |
| 71 |
directory. So in the above example you could create ~/.cdist directory, |
| 72 |
then ~/.cdist/manifest sub-directory and create init manifest |
| 73 |
~/.cdist/manifest/init. |
| 74 |
|
| 75 |
That's it, you've successfully used cdist to configure your first host! |
| 76 |
Continue reading the next sections, to understand what you did and how |
| 77 |
to create a more sophisticated configuration. |