我有以下shell脚本,该脚本用于在远程计算机上安装puppet代理。如果我通过cmd行从本地ubuntu运行,效果很好,例如: sh install_puppet_agent.sh 我通过在jenkins中创建了一个简单的执行shell作业,方法是将install_puppet_agent.sh的内容复制到Build-> Execute shell区域,然后单击“ Save / build”,我得到了: 我已经搜索了一段时间,无法弄清楚。我必须承认我是Jenkins&Puppet的新手。谢谢 答案 0 :(得分:1) 假设这不是您面临的安全问题,则可以在执行作业的Jenkins节点上更新 示例操作方法: https://www.thegeekdiary.com/how-to-fix-the-error-host-key-verification-failed/ 答案 1 :(得分:0) 我只是通过配置jenkins作业来解决此问题:me@me:~$ cat install_puppet_agent.sh
#!/bin/bash
echo "Installing ..."
ssh -t me@puppet-agent << 'INSTALL_PUPPET_AGENT'
wget https://apt.puppetlabs.com/puppet6-release-bionic.deb
echo "mepassword" | sudo -S dpkg -i puppet6-release-bionic.deb
sudo apt-get update
sudo apt install -y puppet-agent
sudo touch /etc/puppetlabs/puppet/puppet.conf
sudo chmod 777 /etc/puppetlabs/puppet/puppet.conf
echo "[main]" | sudo tee -a /etc/puppetlabs/puppet/puppet.conf
echo "certname = puppetagent" | sudo tee -a /etc/puppetlabs/puppet/puppet.conf
echo "server = puppet" | sudo tee -a /etc/puppetlabs/puppet/puppet.conf
echo "environment = production" | sudo tee -a /etc/puppetlabs/puppet/puppet.conf
echo "runinterval = 5m" | sudo tee -a /etc/puppetlabs/puppet/puppet.conf
sudo /opt/puppetlabs/bin/puppet resource service puppet ensure=running enable=true
INSTALL_PUPPET_AGENT
echo "done"
me@me:~$
Installing ...
Host key verification failed.
done
2 个答案:
~/.ssh/known_hosts
文件的内容。/home/me/install_puppet_agent.sh