Discussion:
bashrc or bash_profile not being sourced
jepper
2014-03-05 13:08:12 UTC
Permalink
I think this has been discussed before. The documentations says:

"If you want to run a command through the shell (say you are using <, >, |,
etc), you actually want the shell module instead. The command module is
much more secure as it’s not affected by the user’s environment."

Implicitly, I read this as if I *do* use the shell command, I should get
the users environment. Is this assumption wrong?

Now I do this, occasionally, in order to include anything from my user
profile:
shell: . ~/.bashrc && env > /tmp/env

The use case I have is to install a mule license, which requires MULE_HOME.
I could write a two line wrapper, but I'd rather not have more parts than I
can get away with. I do as follows:
shell: . ~/.bashrc && ./mule -installLicense {{ mule_user_home
}}/mule-ee-license.lic chdir={{ mule_home }}/bin
--
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 ansible-project+***@googlegroups.com.
To post to this group, send email to ansible-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/82685bf4-80ba-4e82-932d-0a5c4c8e5d53%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Brian Coca
2014-03-06 16:00:07 UTC
Permalink
a few things:

- you have a hash in ansible_env that shows what the environment is (for
user you gathered facts as).
- ansible doesn't source .rc files
- the environment: keyword lets you set env variables for the execution
context.
--
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 ansible-project+***@googlegroups.com.
To post to this group, send email to ansible-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CADn%2BHsxMbZ-%2BFPz9aD2sqKk5bPbPKsVtsyH0N85NqY79J6X%2BGA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.
Loading...