# tasks, roles and modules: how best to compose functionality?

**URL:** <https://forum.ansible.com/t/tasks-roles-and-modules-how-best-to-compose-functionality/17572>\
**Category:** Ansible Project\
**Created:** [February 20, 2015, 11:17am UTC](https://forum.ansible.com/t/tasks-roles-and-modules-how-best-to-compose-functionality/17572 "2015-02-20T11:17:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![nrser](https://avatars.discourse-cdn.com/v4/letter/n/919ad9/32.png) [@nrser](https://forum.ansible.com/u/nrser)\
**Post date:** [February 20, 2015, 11:17am UTC](https://forum.ansible.com/t/tasks-roles-and-modules-how-best-to-compose-functionality/17572/1 "2015-02-20T11:17:44Z")

</div>

i’m just getting started with Ansible, and would appreciate some help on how best to compose functionality with tasks, roles and modules.

i’m thinking of a basic structure that i imagine is somewhat common, where

- hosts have projects

- projects have github repos

- github repos have git module tasks that actually clone the repo  
some pseudo code:

some-project  
github\_repo:  
owner: nrser  
name: some-project

github\_repo

git:  
repo: [git@github.com](mailto:git@github.com):{{ owner }}/{{ name }}  
dest: "{{ gh\_root }}/{{ owner }}/{{ name }}

how should i accomplish this in Ansible? should `some-project` and `github_repo` be tasks, roles…?

---

<div class="post-metadata">

**Author:** ![Dick\_Davies](https://avatars.discourse-cdn.com/v4/letter/d/b9e5f3/32.png) [@Dick\_Davies](https://forum.ansible.com/u/Dick_Davies)\
**Post date:** [February 20, 2015, 2:54pm UTC](https://forum.ansible.com/t/tasks-roles-and-modules-how-best-to-compose-functionality/17572/2 "2015-02-20T14:54:08Z")

</div>

Have a look at 'parameterized roles' at :

&nbsp;&nbsp;&nbsp;&nbsp;[http://docs.ansible.com/playbooks\_roles.html#roles](http://docs.ansible.com/playbooks_roles.html#roles)
