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/CAL8fbwON7%2B%2Bw_M%3DDNFHjJ3HN5WhxmSws9jTHZGj5QiYtO1ipng%40mail.gmail.com.

Reply via email to