我正在制作 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/