Hi All,

I've a similar problem, but I want to load environment variable 
"ORACLE_HOME" based on the hostname since ORACLE_HOME is different for each 
server.
And, there are n number of hosts defined in inventory, which in turn 
assigned to groups like dev, sit, uat etc.

In my scenario, I'm passing env_name to playbook, which resolves hostnames 
and does the deployment on those servers. I don't want to keep separate 
playbook for each server due to different ORACLE_HOME.

I tried multiple ways to do it. But no luck.

Anyone aware, how it can be achieved?

Thanks,
Ashish Kumar


On Friday, October 2, 2015 at 8:22:52 PM UTC+5:30, Pratik Dhandharia wrote:
>
> Thanks for clarifying my understanding and suggesting a workaround. 
>
> It worked! 
>
> On Thursday, October 1, 2015 at 7:18:39 PM UTC-4, Brian Coca wrote:
>>
>> source is not a command its a builtin in bash, ansible uses /bin/sh if 
>> it is not a symlink to bash or bash is set to do strict sh you won't 
>> have 'source', but you always have . which does the same thing. 
>>
>> that said 
>>
>>  shell: source /etc/profile 
>>
>> is a noop, it does nothing as ansible will open a new shell and that 
>> info won't be available in other tasks. 
>>
>>
>> you can do this to set an environment var for all tasks in a play: 
>>
>> - hosts: all 
>>   environment: 
>>        RHOME: /path/to/r 
>>   tasks: 
>>      - .... 
>>
>>
>>
>> -- 
>> Brian Coca 
>>
>

-- 
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/0db46cac-f59e-4f41-8aaa-d34c7a16bcf0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to