# Referencing roles within a module?

**URL:** <https://forum.ansible.com/t/referencing-roles-within-a-module/25314>\
**Category:** Ansible Project\
**Tags:** galaxy-ng\
**Created:** [August 23, 2017, 12:04pm UTC](https://forum.ansible.com/t/referencing-roles-within-a-module/25314 "2017-08-23T12:04:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![josphill](https://avatars.discourse-cdn.com/v4/letter/j/ecccb3/32.png) [@josphill](https://forum.ansible.com/u/josphill)\
**Post date:** [August 23, 2017, 12:04pm UTC](https://forum.ansible.com/t/referencing-roles-within-a-module/25314/1 "2017-08-23T12:04:06Z")

</div>

First off, I am pretty new to Ansible roles, so please bear with me. There is a set of roles in a module ([GitHub - redhat-cop/casl-ansible: Ansible automation for Managing OpenShift Container Platform clusters](https://github.com/redhat-cop/casl-ansible)), and I want to use a role within that module called `oc-apply`. How do I reference that?

I created a YAML file to install the module:

`

# This is the Ansible Galaxy requirements file to pull in the correct roles

# to support the operation of CASL provisioning/runs.

- src: [GitHub - redhat-cop/casl-ansible: Ansible automation for Managing OpenShift Container Platform clusters](https://github.com/redhat-cop/casl-ansible)

scm: git  
version: master  
`

And a playbook which is wanting to use the `oc-apply` role within that module

`

---

<div class="post-metadata">

**Author:** ![josphill](https://avatars.discourse-cdn.com/v4/letter/j/ecccb3/32.png) [@josphill](https://forum.ansible.com/u/josphill)\
**Post date:** [August 23, 2017, 12:27pm UTC](https://forum.ansible.com/t/referencing-roles-within-a-module/25314/2 "2017-08-23T12:27:09Z")

</div>

I found a work-around, but I am not sure if it is the correct way to handle this.

After installing via ansible-galaxy as described above, I used the following playbook to run the role:

`

---

<div class="post-metadata">

**Author:** ![Soniya\_panwar](https://avatars.discourse-cdn.com/v4/letter/s/22d042/32.png) [@Soniya\_panwar](https://forum.ansible.com/u/Soniya_panwar)\
**Post date:** [August 23, 2017, 6:26pm UTC](https://forum.ansible.com/t/referencing-roles-within-a-module/25314/3 "2017-08-23T18:26:46Z")

</div>

yes, you are doing this in right way, you can call role directly or you can parameterize the roles:  
Example:

```auto
---

```
