Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vb.net/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
无法将Ansible duo的默认ruby版本设置为bash环境_Ruby_Rvm_Ansible - Fatal编程技术网

无法将Ansible duo的默认ruby版本设置为bash环境

无法将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

我正在使用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
  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
函数

我试过Ansible
1.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很烦人。