# roles and "script:" module.

**URL:** <https://forum.ansible.com/t/roles-and-script-module/13489>\
**Category:** Ansible Project\
**Created:** [September 16, 2013, 9:23pm UTC](https://forum.ansible.com/t/roles-and-script-module/13489 "2013-09-16T21:23:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kashyap\_Bhatt](https://avatars.discourse-cdn.com/v4/letter/k/f0a364/32.png) [@Kashyap\_Bhatt](https://forum.ansible.com/u/Kashyap_Bhatt)\
**Post date:** [September 16, 2013, 9:23pm UTC](https://forum.ansible.com/t/roles-and-script-module/13489/1 "2013-09-16T21:23:41Z")

</div>

Hi,

According to this [documentation of Roles feature](http://www.ansibleworks.com/docs/playbooks.html#roles)  
“Any script tasks can reference scripts in roles/x/files/ without having to path them relatively or absolutely”

But this seems to be true only for tasks belonging to that particular role (see my\_role\_task\_call\_script in the output below). When I reference a script from the main playbook (which uses the role) I get the following:  
fatal: [remote\_host] =\> file or module does not exist: /login/user/ansible/playbook\_hello/some\_script.sh

Did I misunderstand the feature, it’s a bug or am I doing something wrong? Code and output attached.

Thanks  
Kashyap

Search for “XXXX”, same thing available in attachment (Document1.txt) too.

sg219898@remote\_host\> ansible --version  
ansible 1.2.2  
user@host $  
user@host $ uname -a  
Linux xxxx 2.6.32-358.11.1.el6.x86\_64 #1 SMP Wed May 15 10:48:38 EDT 2013 x86\_64 x86\_64 x86\_64 GNU/Linux  
user@host $  
user@host $ pwd  
/login/user/ansible/playbook\_hello  
user@host $ ls -lR  
.:  
total 8  
-rw-r–r-- 1 user group 133 Sep 16 15:50 hello.yml  
drwxr-xr-x 3 user group 4096 Sep 16 15:43 roles

./roles:  
total 4  
drwxr-xr-x 4 user group 4096 Sep 16 15:47 my\_role

./roles/my\_role:  
total 8  
drwxr-xr-x 2 user group 4096 Sep 16 15:44 files  
drwxr-xr-x 2 user group 4096 Sep 16 15:48 tasks

./roles/my\_role/files:  
total 0  
-rwxr-xr-x 1 user group 17 Sep 16 15:44 some\_script.sh

./roles/my\_role/tasks:  
total 0  
-rw-r–r-- 1 user group 63 Sep 16 15:48 main.yml  
user@host $  
user@host $ cat ./roles/my\_role/files/some\_script.sh

echo inside $0

user@host $ ./roles/my\_role/files/some\_script.sh  
inside ./roles/my\_role/files/some\_script.sh  
user@host $  
user@host $ cat ./roles/my\_role/tasks/main.yml

> **(attachments)**
>
> [code.zip](https://forum.ansible.com/uploads/short-url/6t56jnMk3vBo4OANXRx1gHkRHmN.zip) (1.34 KB)  
> [Document1.txt](https://forum.ansible.com/uploads/short-url/uaP7bfCVKrpT3mIvwLrHvCKRJv5.txt) (4.58 KB)

---

<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:** [September 16, 2013, 9:28pm UTC](https://forum.ansible.com/t/roles-and-script-module/13489/2 "2013-09-16T21:28:34Z")

</div>

Hi,

Please don’t attach files to the mailing list.

We’d much prefer linking to things on [gist.github.com](http://gist.github.com) or elsewhere where they are easily web browseable.

Thanks!

–Michael
