difference in "ansible PATH" & "server-side PATH"

84 views
Skip to first unread message

TheUnseen

unread,
Feb 12, 2016, 9:18:02 AM2/12/16
to Ansible Project
Hi there,

I'm pretty new to ansible and trying to install rvm threw its official role system-wide.
Through installation process I came across a "rvm command not found" error, which (thru further diggin) brought me to the following question:

How come, that my PATH differs, depending if I ask for it with ansible or directly?

user@mgmt:~$ ansible web1 -a "echo $PATH"
web1 | SUCCESS | rc=0 >>
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games

user@web1:~$ echo $PATH
/usr/local/rvm/gems/ruby-2.1.3/bin:/usr/local/rvm/gems/ruby-2.1.3@global/bin:/usr/local/rvm/rubies/ruby-2.1.3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/local/rvm/bin

Im using ansible 2.0.0.2


Grateful for any help!

cheers

Mark McCoy

unread,
Feb 12, 2016, 9:36:11 AM2/12/16
to ansible...@googlegroups.com
When you login, there is a system-wide profile script that is imported with the barebones environment variables that are global to all users, then your local .profile is imported. 

If the shell is an interactive shell, then a third script (usually .bashrc for BASH or .zshrc for ZSH) is run containing variables for command line interactive use. Your additions to the path that add the paths to rvm are probably in there and not .profile. Since the ansible login isn't interactive the .bashrc never gets imported. 
--
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-proje...@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/73525f21-5298-42c1-a6f0-0f1890391eed%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--

TheUnseen

unread,
Feb 16, 2016, 2:57:06 AM2/16/16
to Ansible Project
Cheers! Pointed me to the right direction.


Am Freitag, 12. Februar 2016 15:36:11 UTC+1 schrieb Mark McCoy:
When you login, there is a system-wide profile script that is imported with the barebones environment variables that are global to all users, then your local .profile is imported. 

If the shell is an interactive shell, then a third script (usually .bashrc for BASH or .zshrc for ZSH) is run containing variables for command line interactive use. Your additions to the path that add the paths to rvm are probably in there and not .profile. Since the ansible login isn't interactive the .bashrc never gets imported. 

On Friday, February 12, 2016, 'TheUnseen' via Ansible Project <ansible...@googlegroups.com> wrote:
Hi there,

I'm pretty new to ansible and trying to install rvm threw its official role system-wide.
Through installation process I came across a "rvm command not found" error, which (thru further diggin) brought me to the following question:

How come, that my PATH differs, depending if I ask for it with ansible or directly?

user@mgmt:~$ ansible web1 -a "echo $PATH"
web1 | SUCCESS | rc=0 >>
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games

user@web1:~$ echo $PATH
/usr/local/rvm/gems/ruby-2.1.3/bin:/usr/local/rvm/gems/ruby-2.1.3@global/bin:/usr/local/rvm/rubies/ruby-2.1.3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/local/rvm/bin

Im using ansible 2.0.0.2


Grateful for any help!

cheers

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.


--

Reply all
Reply to author
Forward
0 new messages