Ansible Role for OpenStack Development

As mentioned previously, I have been using
ansible for managing my development configuration for a few months
now, and I’m finally getting around to releasing some of the roles
I’ve created in a form (possibly) useful to other folks. This one
configures some of the packages needed to run unit tests for OpenStack
projects.

Features

There’s nothing quite as annoying as having tox fail to build a test
environment because some system package is missing. The
openstack-dev role installs many of the commonly needed system
dependencies, such as libxml2 and libffi-dev. It isn’t an
exhaustive list, and it isn’t sufficient to run OpenStack properly,
but it does allow most of the unit tests to run, including some that
are optional when driver libraries are not present. For a complete
list of packages installed, refer to the source.

The role also sets up a working directory
(openstack_dev_repos_dir) where the git repositories containing
OpenStack source can be checked out. The role clones the
openstack/oslo-incubator and creates an update.sh script in
the openstack_dev_repos_dir to call the tool from the
oslo-incubator for cloning copies of all of the OpenStack source
trees.

The role also clones openstack/requirements, which contains
tools/build_wheels.sh, a script for building wheels of all of the
OpenStack project Python requirements. Since the role depends on
dhellmann.devpi, a devpi server is set up running on the
development server. Running build_wheels.sh will populate the
cache for the devpi server and the wheelhouse so that tox environment
builds for the unit tests for projects with a lot of dependencies will
go more quickly.

Installing the Role

Clone the role from github or use ansible-galaxy to install
dhellmann.openstack-dev. If you use ansible-galaxy, the
dependencies will also be installed automatically.

$ ansible-galaxy install dhellmann.openstack-dev
- downloading role 'openstack-dev', owned by dhellmann
- downloading role from https://github.com/dhellmann/ansible-openstack-dev/archive/1.0.0.tar.gz
- extracting dhellmann.openstack-dev to roles/dhellmann.openstack-dev
- dhellmann.openstack-dev was installed successfully
- adding dependency: dhellmann.devpi
- adding dependency: dhellmann.python-dev
- downloading role 'devpi', owned by dhellmann
- downloading role from https://github.com/dhellmann/ansible-devpi/archive/1.0.0.tar.gz
- extracting dhellmann.devpi to roles/dhellmann.devpi
- dhellmann.devpi was installed successfully
- downloading role 'python-dev', owned by dhellmann
- downloading role from https://github.com/dhellmann/ansible-python-dev/archive/1.0.0.tar.gz
- extracting dhellmann.python-dev to roles/dhellmann.python-dev
- dhellmann.python-dev was installed successfully

Add the role to your playbook for your development server, and
optionally set openstack_dev_repos_dir.

Cloning the Source

After running the playbook, login to the server and:

$ cd ~/repos
$ ./update.sh

If you changed openstack_dev_repos_dir, replace the cd command
with the appropriate value.

Building Wheel Cache

$ cd ~/repos/openstack/requirements
$ ./tools/build_wheels.sh 2.7 3.4

The command will take some time, so you may want to get lunch while
you wait.