Home

EGI Ansible Style Guide

Community guide to developing re-usable Ansible products for EGI infrastructure

EGI Ansible Style Guide Usage

This repository contains style guide for EGIโ€™s use of Ansible. It is meant to complement Ansibleโ€™s own style guide, with a focus on helping developers and maintainers of EGI roles. This style guide will help you to follow to develop roles of high quality and re-usability by assisting in:

Build styling ๐Ÿ„๐Ÿพ Ansible roles, all dressed up and ready to roll ๐Ÿ‘— using a clean, robust template.
Test Ansible
Write consistent tests ๐Ÿ›‚ for deployment scenarios and adhere to the EGI Quality Criteria
Pass an expert eye over your code, applying the Ansible Fashion Police ๐Ÿ‘ฎ๐Ÿฝโ€โ™€๏ธ compliance profile to help you stick with the style guide as you code, and ensure long-term sustainability and re-usability of your roles.

Quickstart for the super keen ๐Ÿ˜.

Set up your development environment

You will need molecule and the corresponding Ansible release to develop roles.

$virtualenv egi-ansible
New python executable in egi-ansible/bin/python
Installing setuptools, pip, wheel...done.
$source egi-ansible/bin/activate
(egi-ansible)$ pip install molecule

We assume you already have git, python (2 or 3) and pip installed


Clone this repository

git clone https://github.com/EGI-Federation/ansible-style-guide

Use the customised Ansible Galaxy skeleton when developing roles

ansible-galaxy init \
--role-skeleton=ansible-style-guide/egi-galaxy-template/ \
ansible-role-awesome-thing

We have added a lot of extras to the vanilla Ansible Galaxy template. EGIโ€™s Ansible Galaxy role skeleton includes:

  • Testing on Travis
  • Clean generation of meta/main.yml for EGI target platforms
  • GitHub issue and pull request templates
  • Community Health improvement files such as guides for contributors, READMEs and codes of conduct.

Write some failing tests

See the Testing page for more.


Refer to the style guide when reviewing pull requests.

Dive Deeper

The Ansible