tis 2017-01-10 klockan 21:59 -0800 skrev Mona Gopal: > Even i am trying to source the bashrc file on my target system. > Ansible runs successfully without errors but doesn't source the file. > Below is my task: > > - name: source bashrc file > shell: source ~/.bashrc > args: > executable: /bin/bash
The problem here isn't that Ansible isn't sourcing the file. The problem is that Ansible isn't sourcing it in a helpful way. Defined environment variables only take affect in the current process and its child processes. It doesn't have any affect on parent nor sibling processes. Hence, what is happening here is that Ansible is starting a new shell processes which sources your ~/.bashrc. Right afterwards the shell processes is exited, and Ansible forgets all about its environment. Is it an alternative to instead explicitly define the needed environment variables in the playbook? https://docs.ansible.com/ansible/playbooks_environment.html // Andreas -- 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/1484117985.2585.11.camel%40arrakis.se. For more options, visit https://groups.google.com/d/optout.
