Thanks for the quick reply,
That didn't work either, still comes up with the same error:
"module_args": {
"_raw_params": "bash -lc 'source /root/vBNG/env.sh && ins'",
"_uses_shell": true,
"argv": null,
"chdir": null,
"creates": null,
"executable": null,
"removes": null,
"stdin": null,
"warn": false
}
},
"msg": "non-zero return code",
"rc": 127,
"start": "2019-04-30 16:54:34.129834",
"stderr": "bash: ins: command not found",
"stderr_lines": [
"bash: ins: command not found"
On Tuesday, April 30, 2019 at 4:47:25 PM UTC+1, Sudheer S wrote:
>
>
> On 30/04/19 9:02 PM, bren85 wrote:
> > I am trying to source a script on a remote host so I can use the
> > functions in it.
> > I have tried:
> >
> > shell: source [filename.sh] && [function name]
> > args:
> > executable: /bin/bash
> >
> > and a lot of variations on this.
> >
> > Now I have managed to source the script locally by adding the source
> > command to the .bash_profile file.
> >
> > The functions are available to me when i log into the remote host and
> > run the functions manually from the terminal.
> >
> > When I send:
> >
> > shell: [function name]
> >
> > to the remote host, it comes up:
> >
> > "/bin/bash: [function name]: command not found"
> >
> > Both control and remote node are running /bin/bash
> > Is there something I am missing?
> >
> >
> Yes, you need a login shell. The Ansible shell module does not use a
> login shell.
>
> Try:
>
> shell: bash -lc 'source [filename.sh] && [function name]'
>
> -
>
> Sudheer S
>
>
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/fc8e9f35-f9f3-49dc-8f33-1eeb3a93d150%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.