Fully Automating the Redmine Gitolite Integration

This is the last in a series of articles where I described the installation of gitolite (twice in two different ways), redmine, and the integration of them.  I also described in detail some methods for modularizing the configuration changes that needed to happen for the server, and various applications, when it was possible.  These articles are:

In this final tutorial, we are going to automate the deployment of this process using Ansible (http://ansible.github.com/gettingstarted.html). There are other options for global configuration management, and puppet and chef are what immediately come to mind. I know that puppet uses phone home style setup, and I’m not sure about chef, but ansible uses more of a push method, telling the server what to do rather than letting the server figure it out for itself. This means that we don’t have to install any clients on the box that we are talking to, except for the fairly ubiquitous ssh daemon. The servers controlled by Ansible also require python and a python json library.

When I started this, I was building a new VM in the background. I got it to the point where it was downloading packages (Ubuntu 12.04) then started on the next steps.

We need to get ansible installed on our local machine (our desktop Ubuntu, or a primary development VM). Install git-core if you don’t have it yet with $ sudo apt-get install git-core and download the ansible source code with $ git clone git://github.com/ansible/ansible.git ~/ansible. Ansible also requires a few packages: python-paramiko, python-yaml and python-jinja2, all installed with apt-get in the same way as git-core. After these are all there, we can go into the ansible directory (cd ~/ansible), run git checkout origin/devel, and run $ sudo make install. Run the command $ ansible to see if all is well. Please use the getting started documentation for Ansible to learn more about it, or if you have problems.

Now that you have a new VM set up, check out the repository at https://github.com/paulsalcido/redmine-gitolite-ansible using:

git clone git://github.com/paulsalcido/redmine-gitolite-ansible.git

All commands listed assume that you are in the root directory of this checkout.

Now you need to set up the hosts file in this repository to contain the appropriate host names for the database and primary redmine/gitolite server. You also need to add three files under keys. These files are ‘authorized_keys’, which should contain a public key that you can use, gitolite-ssh-key, which will be a private key for gitolite, and gitolite-ssh-key.pub. This can be created using ssh-keygen and setting the file name as keys/gitolite-ssh-key. Now, under vars, make sure that everything is set correctly for your setup to work properly in the file default.yml.

When you first create an ubuntu install, it asks for a default user. You need to know the name and password of this default user to start the setup.yml, and after that, everything should work as long as the authorized_keys file was set up properly. Run the following:

ansible-playbook setup.yml --user=[default user] --ask-pass --ask-sudo-pass --inventory-file=./hosts

Now, the next set of commands should run much more easily (as root will be set up with the public key, which is risky, and your private key should be protected).

ansible-playbook database.yml --inventory-file=./hosts
ansible-playbook gitolite.yml --inventory-file=./hosts
ansible-playbook redmine.yml --inventory-file=./hosts
ansible-playbook redmine-gitolite-integrate.yml --inventory-file=./hosts

And now you can test your redmine instance by going to http://%5Bredmine host]:[redmine port]/ (as configured in the previous steps).



  1. Just a note that the redmine gitolite plugin does not work with latest redmine in squeeze ( 1.4.4 ).

  2. Sorry forgot to add that you should use the plugin from https://github.com/kubitron/redmine_git_hosting ( not compatible with redmine 2 but at least there’s no parse errors with this one one squeeze/wheezy ).

  3. https://github.com/jbox-web/redmine_git_hosting

    This one works with Redmine 2. It also adds new features 😉

    Have fun!

  4. yes, this is definitely a dated post. I used it mostly as a practice run for ansible, etc.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: