ssh - Chef Recipe : automatically type yes if prompted

标签 ssh chef-infra

我正在制作 Recipe 以将文件从提供的存储库克隆到节点。这是我的 Recipe :

execute 'clone files from stash' do
     command 'git clone <REPOSITORY_DIR> /var/www'
end

但是当我运行这个 chef-client在我的节点上,它返回错误说:
Expected process to exit with [0], but received '128'
---- Begin output of git clone [REPOSITORY_URL] /var/www ----
STDOUT: Cloning into '/var/www'...
STDERR: Host key verification failed.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

当我尝试手动运行命令时,我得到了这个:
[root@wwwblibli /]# git clone REPO_URL /var/www
Cloning into '/var/www'...
The authenticity of host '[REPO_URL]:8000 ([REPO_IP]:7999)' can't be established.
RSA key fingerprint is xxxx.
RSA key fingerprint is xxxx.
Are you sure you want to continue connecting (yes/no)?

有没有办法自动回复yes提示时,或任何命令自动将存储库添加到已知主机?

*注意:我已将节点的公钥注册到存储库

最佳答案

使用 git资源,或者可能是 poise_git资源,如果您需要支持部署 key 。它为您处理禁用交互式内容。

关于ssh - Chef Recipe : automatically type yes if prompted,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49728820/

相关文章:

python - PyChef - 是否有 REST API 来让 Chef 客户端运行

bash - GNU上的GNU并行错误

chef-infra - Chef ,在您的 Recipe 路径中找不到 Recipe

ubuntu - 使用 Chef 在 Ubuntu 12.04 上设置 ACL

windows - 扩展 Chef Windows Cookbook...DISM 限制

linux - 我可以使用 ssh 登录另一个主机并自动将 "su"发送给另一个用户吗?

php - 如何知道一个命令已执行并完成执行另一个命令(ssh - php)

SSH,连接建立,但卡住

ssh - 如何使用 zsh 自动完成哈希已知主机

chef-infra - 为不同的服务器组织 Chef Recipe