我正在尝试使用Ansible安装RVM以在远程(RedHat 6.x)系统上安装更新版本的Ruby。我已经尝试了两个单独的Ansible-RVM剧本(rvm/rvm1-ansible和newmen/ansible-rvm),但它们都表现出相同的行为:它们都达到了剧本指导RVM安装Ruby的步骤,然后停止直到我取消流程:
while((entry = readdir(dp))) {
// need to continue to next iteration of loop, here, if entry->d_name matches glob pattern
// do stuff and recurse
}
原因似乎是RVM要求某种登录信息。当我通过SSH连接到相关主机手动运行RVM时,我得到一个提示TASK: [ansible-rvm | installing Ruby as root]
*********************************
<HOST.DOMAIN.xyz>
<HOST.DOMAIN.xyz>
<HOST.DOMAIN.xyz> IdentityFile=/Users/USER/.ssh/private-key-file ConnectTimeout=10 PasswordAuthentication=no KbdInteractiveAuthentication=no ControlPath=/Users/USER/.ansible/cp/ansible-ssh-%h-%p-%r PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey ControlMaster=auto ControlPersist=60s
<HOST.DOMAIN.xyz>
<HOST.DOMAIN.xyz> IdentityFile=/Users/USER/.ssh/private-key-file ConnectTimeout=10 'sudo -k && sudo -H -S -p "[sudo via ansible, key=KEY] password: " -u root /bin/sh -c '"'"'echo SUDO-SUCCESS-KEY; LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python /home/USER/.ansible/tmp/ansible-tmp-dir/command; rm -rf /home/USER/.ansible/tmp/ansible-tmp-dir/ >/dev/null 2>&1'"'"'' PasswordAuthentication=no KbdInteractiveAuthentication=no ControlPath=/Users/USER/.ansible/cp/ansible-ssh-%h-%p-%r PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey ControlMaster=auto ControlPersist=60s
^CERROR: interrupted
:
Username:
无论$ rvm install ruby-2.2.2
Searching for binary rubies, this might take some time.
No binary rubies available for: redhat/6/x86_64/ruby-2.2.2.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for redhat.
Enabling optional repository
Username: ^C
User interrupted process.
命令是否在rvm
下运行,都会发生上述情况。
我无法找到任何关于RVM请求的登录/用户名的文档,也没有关于我可以应用的标志或配置的任何说明以禁用交互性;事实上,我还没有找到任何与RVM结合使用的登录提示。有没有人遇到过这个问题?
答案 0 :(得分:0)
原因是rvm正在尝试安装系统要求,并且需要输入sudo密码。
我已在此here
中的rvm1-ansible commit的分叉中修复此问题在Ubuntu为我工作。
---
- name: Configure servers with ruby support for single user
hosts: newservers
become: yes
roles:
- { role: rvm_io.ruby,
tags: ruby,
rvm1_rubies: [2.3.3],
rvm1_user: 'sudouser',
rvm1_install_flags: '--auto-dotfiles --user-install',
rvm1_install_path: '/home/{{ ansible_user }}/.rvm',
}
使用sudo用户启动任务:
ansible-playbook -i hosts.ini ruby_script.yml --user sudouser --ask-sudo-pass