# The ansible-repository project

**URL:** <https://forum.ansible.com/t/the-ansible-repository-project/12548>\
**Category:** Ansible Project\
**Created:** [March 21, 2013, 5:33am UTC](https://forum.ansible.com/t/the-ansible-repository-project/12548 "2013-03-21T05:33:09Z")\
**Posts on this page:** 6\
**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 21, 2013, 5:33am UTC](https://forum.ansible.com/t/the-ansible-repository-project/12548/1 "2013-03-21T05:33:09Z")

</div>

Actually I did already and it doesn’t work for me : tasks are copied from lamp\_simple to lamp\_haproxy rather than reused. For example, the apache install file exists in both directories.

Imagine the two playbooks (haproxy and simple) are used by two different people/teams, they will both try to figure out what is the best way to install and configure apache instead of working together on it.

What i’m trying to achieve is a set of conventions that allows for a centralized repository of ansible plays and playbooks.

Rodolfo

---

<div class="post-metadata">

**Author:** ![benno\_joy](https://avatars.discourse-cdn.com/v4/letter/b/73ab20/32.png) [@benno\_joy](https://forum.ansible.com/u/benno_joy)\
**Post date:** [March 21, 2013, 6:33am UTC](https://forum.ansible.com/t/the-ansible-repository-project/12548/2 "2013-03-21T06:33:53Z")

</div>

Ok, Would this help:

Consider lamp\_haproxy as your main/only repository and if a team wants to delpoy a simple lamp stack, he/she can copy the site.yml and remove the include for haproxy, which give them lamp\_simple.  
If another team team wants lamp\_haproxy just use site.yml.  
and say if a new team wants lamp+ nginx … they would have to just create a new roles folder and put the plays in that directory  
roles/nginx/tasks/main.yml  
and in the top level directory create the playbook for configuring lamp + nginx.

It might look like:

- include playbook/db.yml
- include playbooks/web.yml
- include playbook/nginx.yml

In short roles directory would become your core repository for reusable playbooks. and playbooks folder would have your team specific playbooks.

Benno

---

<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 21, 2013, 6:42am UTC](https://forum.ansible.com/t/the-ansible-repository-project/12548/3 "2013-03-21T06:42:14Z")

</div>

Thanks.  
When building my own playbooks i started doing just that : having a general playbook that includes more specific ones. The limitation is that hosts are kind of “hard coded”.

In other words, i think a central repository should provide reusable task lists, not reusable playbooks. Playbooks are specific to an infrastructure, a set of VMs, etc ; they contain passwords, and specific settings.  
Task lists, handlers, etc on the other hand are totally reusable : i can have separate sets of debian VMs, each one configured differently, but they way I install and maintain mysql ou postgresql will be the same.  
Hence the setup i propose in [https://github.com/gaspaio/ansible-repository](https://github.com/gaspaio/ansible-repository)

Does this sound reasonable to you ?

R

---

<div class="post-metadata">

**Author:** ![benno\_joy](https://avatars.discourse-cdn.com/v4/letter/b/73ab20/32.png) [@benno\_joy](https://forum.ansible.com/u/benno_joy)\
**Post date:** [March 21, 2013, 7:21am UTC](https://forum.ansible.com/t/the-ansible-repository-project/12548/4 "2013-03-21T07:21:07Z")

</div>

Looks good to me, but i would definitely let others also comment.

🙂 but still i would love to see those mysql/hg etc… grouped together into directory roles and a top level directly playbooks with those example\_mysql etc… .  
Can be the issue of hardcoded hosts be resolved using separate inventory file’s or groups or using --limit feature. But again your current design might be best suited for your use case.

Benno

---

<div class="post-metadata">

**Author:** ![benno\_joy](https://avatars.discourse-cdn.com/v4/letter/b/73ab20/32.png) [@benno\_joy](https://forum.ansible.com/u/benno_joy)\
**Post date:** [March 21, 2013, 7:37am UTC](https://forum.ansible.com/t/the-ansible-repository-project/12548/5 "2013-03-21T07:37:28Z")

</div>

Just an observation, for your variables for webservers,mysql if etc… you can have it in  
group\_vars/webservers variables for webservers  
group\_vars/all for all hosts etc…

Regards,  
Benno

---

<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 21, 2013, 12:15pm UTC](https://forum.ansible.com/t/the-ansible-repository-project/12548/6 "2013-03-21T12:15:26Z")

</div>

Roles or the group\_vars are properties of the playbooks, not of what i call “Parts”, tasks+templates+handlers. I’ll probably add a separate directory with subdirectories by roles and dedicated playbooks, variables, etc ; those playbooks will then reference the main Parts repository.

I’ll have proof of concept on that soon (i hope).

Thanks for your remarks.  
And I agree with you, it would be great if other people told us what they think !

R
