On 2/20/20 3:53 AM, Sivaraman P wrote:
Gopi Krishna, Did you got any solution for this? Now I was in the same situation.

I can expect that any statements executed within the same shell task will have access to the variables, but nowhere else in the system.

What happens if you do the following?:

 - name: "source then env file"
   shell: |
         source  /home/myfiles/setup.env
         echo $ip_net
         echo $home_net

I'm guessing you should get the values you expect.

If you want to configure shell variables to be available system wide for interactive use, look into modifying .bashrc or .bash_profile

Hugo G.


On Wednesday, 21 February 2018 12:27:16 UTC+5:30, Gopi Krishna wrote:

    Hi All,

     - name: "source then env file"
       shell: . /home/myfiles/setup.env

    I used . & source to source the env file, but its was not
    happening the way that works in linux environement

    my setup.env:
    export ip_net=xx.xx.xx
    export home_net=xx.xx.xx


    expected:
    [email protected]> . /home/myfiles/setup.env
    [email protected]> echo $ip_net
    xx.xx.xx.xx
    [email protected]>


    Actual:
    [email protected]> echo $ip_net

    [email protected]>

    its throwing empty for the variable ip_net, how to achieve this

--
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] <mailto:[email protected]>. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/cd73a095-3a89-4f01-b774-352c79d967f3%40googlegroups.com <https://groups.google.com/d/msgid/ansible-project/cd73a095-3a89-4f01-b774-352c79d967f3%40googlegroups.com?utm_medium=email&utm_source=footer>.

--
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/073649d7-d9fe-7399-10f2-dba363d5a4ae%40redhat.com.

Reply via email to