Tag Archives: tutorial

Setting up a Github project

So I felt like setting up Github repository for awaseroot.¬†Git is a version control system and with Github you can share your git project/repository online. We use Github as a place to share all our awaseroot material. There’s many good tutorials available (for example: http://help.github.com/win-set-up-git/) but here’s the steps I took one by one. Replace awaseroot with whatever you want.

Ubuntu 12.04
Git version

The goal is to publish this:

Like this: Read more of this post

Fabric tutorial 3 – Settings and roles

In this tutorial I’m going to concentrate on various different settings you can use in your fabfile.
These settings can be added to your environmental variables, as decorators or inside the tasks. With roles
we can define which machines are for example servers and which are workstations.

I hope you’ve also read previous tutorials 1 & 2:

Environmental variables

Your default settings should be in the environmental variables right in the beginning of your fabfile.
These are the settings that are used in all of your tasks unless you define it otherwise. These
are the settings that we’ll modify in our tasks later. We have used these in the previous tutorials.



Read more of this post

Fabric tutorial 2 – File transfer & error handling

On the first turorial we learned to run commands on remote hosts with Fabric. Now we move on to
transfering files. Transfering new configuration files is usually quite important part of system administration.
Also retrieving log files from the remote machines might be useful.

Sending files

Let’s assume we’ve made a new ssh_config file with important changes and we want to send it to our
remote hosts. Here’s a task for sending files.

def file_send(localpath,remotepath):

Run it with:
fab file_send:path/to/edited/ssh_config,/etc/ssh/ssh_config
or if the modified ssh_config is in the directory where you’re running Fabric:
fab file_send:ssh_config,/etc/ssh/ssh_config

If we’re sending the file to a location that doesn’t need sudo eg. /tmp/, we don’t need the use_sudo=True.

Another example: Read more of this post

Fabric tutorial 1 – Take command of your network

This is a guide for installing and using Fabric on Ubuntu.
Tested versions:
Ubuntu 11.10
Fabric 1.4.1

Fabric is a Python tool and a library for combining Python with SSH.
The tool can be used to execute Python functions from the command line. It’s also
possible to execute shell commands over SSH with Fabric and by combining the Python functions
with the SSH, it’s possible to automate system administration tasks. (fabfile.org)

Why Fabric?
You can use Fabric as a tool for centralized configuration management. You can run administrative tasks
on all of your machines simultaneously. Fabric is fast and easy to install and start using since there’s
no configuration needed, just install and start adding tasks to your fabfile.

Fabric doesn’t require anything else on the remote systems but a working SSH server. So if you
can control a device with SSH, you can also control it with Fabric. This is why Fabric is such
an easy and nice tool to add to your sysadmin tools. If you prefer Ruby over Python, take a look at a
similiar tool called Capistrano.

In these tutorials I will go through the installation and all the basics you need to start using
Fabric efficietly. Read more of this post