Is there any other way to do this?

On Sat, 22 Feb 2020, 11:46 Dick Visser, <[email protected]> wrote:

> Not really, this is what I meant with that the solution is fragile.
>
>
> On Fri, 21 Feb 2020 at 11:02, Sivaraman P <[email protected]> wrote:
>
>> Now I am able to set the environment using the playbook you have sent.
>> But I Have one more problem in this. The file that I have contains
>> variables like below. As we are reading the file and setting the
>> environment, the values are not passing correctly, Is there any workaround
>> for that?
>>
>> Variables present in the file,
>>
>> export AB_AIR_ROOT=//devetl1/et/devctl/ee/rep/dev
>>
>> export DEV_AIR_ROOT=${AB_AIR_ROOT}
>>
>>
>> after running the playbook, I tried to echo $DEV_AIR_ROOT, But I am
>> getting output as ${AB_AIR_ROOT} instead of getting
>> //devetl1/et/devctl/ee/rep/dev
>>
>>
>> On Thursday, 20 February 2020 21:01:22 UTC+5:30, Dick Visser wrote:
>>>
>>> On Thu, 20 Feb 2020 at 15:13, Sivaraman P <[email protected]> wrote:
>>> >
>>> > Thanks much for your reply, I think this is what the solution I need.
>>> But there are two things which I am not able get. I am new to ansible,
>>> kindly answer those question even though it was silly. whether the
>>> variables which are being used in setfact need to be set before using that
>>> in setfact, if so how to do that.
>>>
>>> I have no idea what you mean. In any case, the playbook just works, so
>>> do some trial and error yourself if you want to see if things are
>>> needed or not.
>>>
>>> > And the 2nd question is
>>> >
>>> > - set_fact:
>>> >       my_env: "{{ envs|default({}) | combine( { item.split('=')[0]:
>>> > item.split('=')[1] } ) }}"
>>> >     loop: "{{ dotenv_pairs.split() }}"
>>> >
>>> > in the above task what is envs and what is the roll of
>>> envs|default({})
>>>
>>> That was a typo, the set_fact tasks should read:
>>>
>>>   - set_fact:
>>>       dotenv_pairs: "{{ dotenv.content | b64decode |
>>> regex_replace('export\\s+', '') }}"
>>>
>>>   - set_fact:
>>>       my_env: "{{ my_env|default({}) | combine( { item.split('=')[0]:
>>> item.split('=')[1] } ) }}"
>>>     loop: "{{ dotenv_pairs.split() }}"
>>>
>> --
>> 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/5c7208fe-7172-41fd-ba4c-28767dc5cf8c%40googlegroups.com
>> <https://groups.google.com/d/msgid/ansible-project/5c7208fe-7172-41fd-ba4c-28767dc5cf8c%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> Sent from a mobile device - please excuse the brevity, spelling and
> punctuation.
>
> --
> 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/CAL8fbwO8BkvHRrLri0EZMauRGF35m%3D0dAGgrE%3DGwcAftpW-ExQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/ansible-project/CAL8fbwO8BkvHRrLri0EZMauRGF35m%3D0dAGgrE%3DGwcAftpW-ExQ%40mail.gmail.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/CAHS7Q%2Bv9_OEC%2BgY7GCpA6Od6QhZBdxBVMWdK-HRsBEGEJmqxyg%40mail.gmail.com.

Reply via email to