无法将Ansible duo的默认ruby版本设置为bash环境
我正在使用Ansible设置RVM,Ruby,我在RVM的路径上遇到了一些问题 我还检查了Ansible Galaxy并从这个例子中学习 我想设置默认的ruby版本无法将Ansible duo的默认ruby版本设置为bash环境,ruby,rvm,ansible,Ruby,Rvm,Ansible,我正在使用Ansible设置RVM,Ruby,我在RVM的路径上遇到了一些问题 我还检查了Ansible Galaxy并从这个例子中学习 我想设置默认的ruby版本 - name: set using ruby 2.1.1 by default shell: "{{ rvm_path }}/rvm use {{ ruby_ver }} --default executable=/bin/bash" 甚至 - name: set using ruby 2.1.1 by default s
- name: set using ruby 2.1.1 by default
shell: "{{ rvm_path }}/rvm use {{ ruby_ver }} --default executable=/bin/bash"
甚至
- name: set using ruby 2.1.1 by default
shell: "source /home/ubuntu/.rvm/scripts/rvm && source /home/ubuntu/.profile && {{ rvm_path }}/rvm use {{ ruby_ver }} --default executable=/bin/bash"
但一切都回来了
"stderr": "RVM is not a function, selecting rubies with 'rvm use ...' will not work.\n\nYou need to change your terminal emulator preferences to allow login shell.\nSometimes it is required to use `/bin/bash --login` as the command
我知道Ansible无法加载bash环境,因此无法充分使用rvm
函数
我试过Ansible1.9.x
和最新的2.x
,但都不起作用
我应该使用哪个参数或参数?为什么不运行bash--login-c“您的rvm命令”
,因此在您的示例中:
- name: set using ruby 2.1.1 by default
shell: "/bin/bash --login -c '{{ rvm_path }}/rvm use {{ ruby_ver }} --default executable=/bin/bash'"
为什么不运行bash--login-c“您的rvm命令”
,在您的示例中:
- name: set using ruby 2.1.1 by default
shell: "/bin/bash --login -c '{{ rvm_path }}/rvm use {{ ruby_ver }} --default executable=/bin/bash'"
你的解决方案有效。现在我正在使用
-命令:“{rvm_path}/rvm alias create default ruby-{{ruby_ver}}”
,它也可以工作。bash环境很烦人,你的解决方案很有效。现在我正在使用-命令:“{rvm_path}/rvm alias create default ruby-{{ruby_ver}}”
,它也可以工作。bash env很烦人。