Kirill Peskov <kirillp@paranoid.email> writes: > I'm currently trying to figure out, how to set global environment > variable, valid for multiple users including root, so Ansible will be > able to accept it as "fact" for both root and non-root users. I've > already tried to play with .cshrc files and /etc/rc.local, nothing > worked so far, looks like I'm missing something important.
You might want to look at configuring Ansible instead. Maybe override its notion of the shell (ansible_env.SHELL) with a value such as "/bin/ksh -l" to force ksh to source the /etc/profile and ~/.profile files. Or maybe create a login class for your ansible users and set the environment variables in /etc/login.conf. Also, assuming ansible is connecting via ssh, maybe set your variables in ~/.ssh/environment. That's per-user though, and the man page does not mention a global equivalent such as /etc/ssh/environment None of these tested, just some ideas. Allan