Search code examples
bashansiblevagrantvirtualbox

Ansible, load /etc/profile from playbook


Please I have a problem when I try to reload bash profile located in /etc/profile.

I tried to load it in many ways, from command: . /etc/profile and with script file with script module and shell as well.

Ansible give my changed status for all, but when I tried to echo the variables inside the profile eg echo $myname they print nothing after finishing execution in playbook.

when I tried to load it again with terminal . /etc/profile the variables is loaded and I can echo it's value.

also I make a script file inside the profile.d directory and load it with Ansible nothing happens.

ps. full root permissions is given with become and --ask-become-pass parameter. I'm using vagrant box with centos 7 X64.

Thank you...


Solution

  • Ansible load my Variables into my global profile, it's ok not changed as it's already placed in that profile

    I pass the script in same environment, so the java read the variables successfully