问题现象
问题分析
登陆远端机器上使用nvm和npm是正常的,而ansible远程登陆无法使用名
可以得出结论:环境变量不一致
1、全局(所有用户)设定 /etc/profile 只有login shell 才会读取
2、局部(依据用户)设定读取 ~/.bash_profile ~/.bash_login ~/.profile
ansible登陆方式为non-login shell
的登陆方式并不会加载 /etc/profile
,并且 如果 ~/.bash_profile
不存在才会读取~/.bash_login
,都不存在才会读取~/.profile