Created: 2012-03-25 09:39
Updated: 2014-10-08 08:30


These are the scripts I use to set up Debian boxes for development, testing, and sometimes even production. Find out more about Ansible.


  • Minimal Debian install with Python and sudo

Set up ansible instances

Set up a Debian machine with minimal installation. All required software will be taken care of by ansible. Make sure ssh connections are possible.

Generate ssh keys on the management machine (Macbook)

User is stephan

macbook: stephan$ ssh-keygen -t rsa
macbook: stephan$ ssh-keygen -t dsa

Set up ssh connection to remote machine (

Setting up the remote machine so you can easily log in using ssh is done using the init playbook.

Add the remote host to your known hosts by connecting once via ssh:

macbook: stephan$ ssh root@

On Mac OS X you need to make sure that sshpass is installed.

macbook: stephan$ brew install

If you execute the init script it also creates a new user called ansible, so make sure you adjust the password to something sensible.

Take the hash for your password from the output of

openssl passwd -salt $1$SomeSalt$ -1 password

Execute the init playbook:

macbook: stephan$ ansible-playbook init.yml -i ./hosts -k

Check if it works:

```macbook: stephan$ ssh ansible@``

Set up ansible to manage remote machine

First, install ansible on your machine (OS X) by using something like HomeBrew:

macbook: stephan$ ruby -e "$(curl -fsSL"
macbook: stephan$ brew install ansible

Add host to hosts:


Executing Playbooks

Executing the playbooks for Ansible requires ansible to be available on all machines involved. If it is, executing the playbooks is as simple as running (-K is only required when password needs to be supplied for executing sudo)

  • ansible-playbook baseinstall_ansible.yml -i ./hosts --ask-pass

The -K switch asks for the sudo password.

  • ansible-playbook baseinstall_ansible.yml -i ./hosts -K --tags "common,dev,mail,web"

Individual steps can be (de-)activated by explicitly calling certain tags using the --tags switch.

Playbooks (tags)


  • Installs some common packages
  • setting the timezone based on an ansible variable


  • apt-get update


  • installs some development packages


  • sets up exim4 to send emails using Google Mail


  • Server monitoring using munin is set up
  • requires nginx


  • sets up nginx as the webserver


  • enables nginx to serve php pages


  • to be done
Cookies help us deliver our services. By using our services, you agree to our use of cookies Learn more