# The ansible-repository project

**URL:** <https://forum.ansible.com/t/the-ansible-repository-project/12538>\
**Category:** Ansible Project\
**Created:** [March 20, 2013, 6:43am UTC](https://forum.ansible.com/t/the-ansible-repository-project/12538 "2013-03-20T06:43:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ggaspaio](https://avatars.discourse-cdn.com/v4/letter/g/b9e5f3/32.png) [@ggaspaio](https://forum.ansible.com/u/ggaspaio)\
**Post date:** [March 20, 2013, 6:43am UTC](https://forum.ansible.com/t/the-ansible-repository-project/12538/1 "2013-03-20T06:43:21Z")

</div>

Hello everybody,

My company’s making the swtich from Puppet to Ansible ; i’m one of those pushing the change.

As such, i’m trying to create an internal coding standard and a set of common building blocks that each team member should use when writing ansible plays and playbooks.

An example of the standards i’m thinking of can be found here :  
[https://github.com/gaspaio/ansible-repository](https://github.com/gaspaio/ansible-repository)

This is a repository of “Parts” : playbook reusable components.

The conventions for writing each part are :

1. 4 directories and 1+ example playbook(s), nothing new here.

2. The tasks directory should contain a file called “setup.yml” : this installs and setups up the application the part is for.

3. Other task files can exist, scripting common actions with the application

4. Each task file should start with a header, describing the task, the variables, the dependencies, etc (cf. [https://github.com/gaspaio/ansible-repository/blob/master/apache/tasks/setup.yml](https://github.com/gaspaio/ansible-repository/blob/master/apache/tasks/setup.yml))

5. A vars/main.yml should exist and contain all variable default values. It should be well commented.

6. All local path files should use the global “repository\_basedir” variable, defined in the playbook. Since local paths used in module “template” for example are relative to the playbook, this allows us to have a global system installation of the ansible repository and still have playbooks anywhere on our system.

7. Tasks should be simple and non specific. They should perform a basic installation of the application only. Anything more should be done by forking the part to a particular playbook or use case.

Does this sound coherent with the ansible projet best practices and usage guidelines ?

Rodolfo

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [March 20, 2013, 3:01pm UTC](https://forum.ansible.com/t/the-ansible-repository-project/12538/2 "2013-03-20T15:01:53Z")

</div>

Hi Rodolfo,

The mailing list moderates first-time posters, so no problems in the  
duplicate post.

I guess the great thing about ansible is it doesn't force you down any  
particular structure. You can see some "best practices" playbooks we  
have published here:

[https://github.com/ansible/ansible-examples](https://github.com/ansible/ansible-examples)

We have plans on expanding these \*VERY\* rapidly for some rather  
involved/useful use cases, largely around distributed systems as  
opposed to single-shot-package-configuration.

You can also see some useful tips here:  
[http://ansible.cc/docs/bestpractices.html](http://ansible.cc/docs/bestpractices.html)

Hope this helps. Obviously you can deviate if you find certain  
things work for you or don't.

--Michael
