绑定到主机 运行 ansible 上的特定 IP 地址

bind to specific IP address on host running ansible

我指定了一台服务器作为我的配置代理。该系统分配了多个 IP 地址。我需要明确使用特定的 IP 地址。

在我管理的 ansible 盒子上,它们有防火墙,只接受来自分配给我的 ansible 供应代理的一个特定 IP 地址的连接。

如何强制 ansibleansible-playbook 绑定到特定的 IP 地址,以便将 IP 地址用作我与 ansible 客户端的所有连接的来源?

在 ssh 中执行此操作的等效标志是 -b,对于 ssh 的描述如下; -b bind_address Use bind_address on the local machine as the source address of the connection. Only useful on systems with more than one address.

如果你想模仿 ssh -b 的行为,那么你应该能够将 -b bind_address 参数添加到你的 ansible 配置文件中的 ssh_args 属性 . Here is the documentation 对于这个 属性。