Hi,
According to this documentation of Roles feature
“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 (1.34 KB)
Document1.txt (4.58 KB)