Hello All,
I have a shell script say ‘test1.sh’, roughly looks like this,
I am trying to execute script with ansible, which throws “No such file or directory” error for “source …/Properties/Main.sh”
However, the script is working fine is I am NOT using ansible.
#/bin/bash
Few Commands
source …/Properties/Main.sh
Make sure the shebang line is correct in your actual script. This mockup lacks the “!”
Potentially important if the Shell invoked by ansible does not implement “source”. (I believe that “.” is managed by posix but source is not.)
Source is a shell built-in. So options are that the Shell this is being run by does not implement it or that the problem is that Main.sh isn’t being found. Make sure that the file is present on the remote host and then try an absolute path (as ansible may be running from a different working directory than you are anticipating)
-Toshio
Hi Toshio,
Thanks was very helpful,
Now I am proving absolute path to source ‘Main.sh’ and it works like a charm.!
Thanks,
Tejas