At the moment I’m doing a shell task, along the lines of “. PATH/env.sh && myscript.py”, also doing sudo: yes, sudo_user: “{{ remote_user }}”
Ideally I’ld like to know how I can specify PATH as a field for my module, then before the module executes on the target server the env.sh is executes before the actual task.
Or if people know another module which does similar I don’t mine reviewing that and working it out for myself. I just can’t figure out how to source the shell script beforehand.
What I’m trying to do is specify a script to execute which will setup the enviroment prior to execution, but that is either not an option or I just can’t find the documentation.
Is their anyway I can get environment to source a shell script?
Also from within a custom module how do I define default environment variables? e.g. the user defines a base dir and the module defines various variables based upon the user provided value?
If I execute $ . ${WL_HOME}/server/bin/setWLSEnv.sh
I get 36 new and 2 modified environment variables, ideally I don’t want the consumer of my custom module to not have to specifiy these manually. I would like the consumer to specify WL_HOME, then get the ansible module framework to execute ${WL_HOME}/server/bin/setWLSEnv.sh
If ansible isn’t able to do this, I’ll try and find a work around. But it might be a useful feature for something like environment_source, so it sources the scripts listed. Or maybe like unsafe where you can do source and it will source the file not define it.
Hi John
Did u find a solution setting up env on target machine using setWLSEnv.sh
I’m struggling too, if you have solved this , can you please help me?