简体   繁体   English

ansible主机文件中的ansible远程服务器名称(jenkins从节点)

[英]ansible remote server name (jenkins slave node) in the ansible host file

I am not sure how to specify my host name in ansible host file. 我不确定如何在ansible主机文件中指定主机名。 I am not able to ping my remote machine because of this. 因此,我无法ping通我的远程计算机。

在此处输入图片说明

在此处输入图片说明

在此处输入图片说明

jenkins slave node name: agent007 jenkins从节点名称:agent007

Please make sure you have mapped the local DNS if you are trying to ping using hostname. 如果尝试使用主机名ping通,请确保已映射本地DNS。 Or else try Ip. 否则尝试叶问。 Also you should make the password-less authentication for this. 您还应该为此进行无密码身份验证。 Use ssh-keygen and copy the pub key to the remote server in authorized hosts file. 使用ssh-keygen并将发布密钥复制到授权主机文件中的远程服务器。

The remote host you are trying to reach needs to be defined in your ansible inventory file, usually named hosts : 您需要访问的远程主机需要在您的清单文件中定义,通常命名为hosts

agent007 ansible_ssh_host=<ip addr>

Then you can explicitly use this inventory file with the -i option 然后,可以通过-i选项显式使用此清单文件

ansible-playbook -i hosts firstplaybook.yml
  1. In /etc/ansible/hosts list the host machines: [localhost] IP address of local host 在/ etc / ansible / hosts中,列出主机:[localhost]本地主机的IP地址
  2. u should have passwordless connection using ssh-keygen -t rsa which will give ua rsa.pubkey which should be copied on authorization keys of host machine 您应该使用ssh-keygen -t rsa进行无密码连接,这将提供ua rsa.pubkey,该副本应复制到主机的授权密钥上
  3. then u can run the playbook 然后你可以运行剧本

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 詹金斯:无法访问主机 - Jenkins: ansible host not reachable 如何使用groovy获取Jenkins中ssh从节点的主机名或ip - How to get the host name or ip of a ssh slave node in Jenkins with groovy 如何查找作为节点添加到Jenkins主服务器的从服务器的IP /主机名? - How to find the IP/Host name of the slave added as a node to the Jenkins Master? Jenkins 动态选择参数读取 github 中的 ansible 主机文件 - Jenkins dynamic choice parameter to read a ansible host file in github 如何使用 ansible 将文件从 Jenkins Workspace 上传到远程目标 - How to upload a file from Jenkins Workspace to a remote dest with ansible 当 ansible 在远程服务器上运行时,有没有办法从 Jenkins 调用 ansible playbook - Is there a way to invoke ansible playbook from Jenkins when ansible is running on a remote server 在没有从机的远程主机上执行 Jenkins 管道 - Execute a Jenkins pipeline on remote host without a slave Jenkins 插件 ssh 发布者无法将文件复制到 ansible 服务器 - Jenkins Plugin ssh Publisher not able to copy file to ansible server Jenkins:在不同的部署方法中进行选择(Master slave vs ansible) - Jenkins: choose among different deployment methods (Master slave vs ansible) Windows节点上的Jenkins从属服务的名称是什么? - What is the name of the Jenkins Slave Service on a Windows Node?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM