简体   繁体   English

在使用python ansible模块为新主机执行ansible剧本时,我们能否忽略要求在.ssh目录中添加主机的问题?

[英]Can we ignore asking to add host in .ssh directory while executing ansible playbook using python ansible module for a new host?

Currently, it's asking to enter yes or no which I want to ignore or pass in program itself, 目前,它要求输入是或否,而我想忽略或传入程序本身,

TASK [Gathering Facts] ************************************************************************************************************************
The authenticity of host '192.168.112.188 (192.168.112.188)' can't be established.
ECDSA key fingerprint is SHA256:UoKxAB0x6sxQCggsklebbnxhdadajdjvsbbb5w.
Are you sure you want to continue connecting (yes/no)? 

If you want to see the code for ansible can refer the question, 如果您想查看ansible的代码,可以参考该问题,

'NoneType' object has no attribute 'upper' while running playbook using ansible-python module? 使用ansible-python模块运行剧本时,“ NoneType”对象没有属性“ upper”吗?

You should alter StrictHostKeyChecking ssh client option. 您应该更改StrictHostKeyChecking ssh客户端选项。

There are multiple ways to achieve this. 有多种方法可以实现此目的。 For example, set this in your ansible.cfg : 例如,在您的ansible.cfg设置:

[ssh_connection]
ssh_args = -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no

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

相关问题 我们可以在 Ansible 控制器主机(可能是 Ansible Tower)上不安装任何额外的 python 模块的情况下将数据从 Ansible 推送到 Kafka 吗? - Can we push data to Kafka from Ansible without installing any extra python module on Ansible controller host (possibly Ansible Tower)? 如何使用 ansible playbook 在 python 中运行 Ansible 模块 - How to run Ansible Module in python with an ansible playbook ansible docker-compose 模块,ansible 的结果与主机上的 ssh 不同 - ansible docker-compose module, different result from ansible than over ssh on the host ansible playbook出错:python mysqldb模块是必需的 - Error on ansible playbook: the python mysqldb module is required Ansible playbook 在新的 Ubuntu/Ansible/Python 环境中停止工作 - Ansible playbook stops working in new Ubuntu/Ansible/Python environment 使用Python API的Ansible Playbook重试逻辑 - Ansible Playbook Retry Logic Using Python API 使用 Python API 运行 ansible-playbook - Running ansible-playbook using Python API 使用 Python API 2.0.0.1 运行 Ansible Playbook - Running an Ansible Playbook using Python API 2.0.0.1 试图在python中为ansible创建一个动态主机文件 - Trying to make a dynamic host file for ansible in python 在没有 python 的目标服务器上执行 ansible 剧本时出错 - Error in executing ansible playbook on target server without python
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM