Ansible:通过代理连接到远程主机

问题描述 投票:0回答:1

我正在编写一部剧本,该剧本需要通过代理连接到几个不同的服务器。

我能够使用腻子和代理来测试连接。基本上,转到连接->代理,然后选择HTTP并添加代理主机。

但是,我无法从Ansible服务器使用SSH复制它。我尝试了不同的ssh命令:

ssh -L jumphost.example.org:80 [email protected] -p 443
ssh -J jumphost.example.org:80 [email protected]
ssh -o ProxyCommand="ssh -W %h:%p jumphost.example.org" server.example.org
ssh -tt jumphost.example.org ssh -tt server.example.org

我知道有很多使用nc的选项,但是我没有尝试过,因为它没有安装在服务器上。

有没有办法使用代理连接到远程主机?

谢谢

ansible remote-server
1个回答
0
投票

您可以尝试这个吗?-主持人:全部remote_user:root

  tasks:

    - name: Install cobbler
      package:
        name: cobbler
        state: present
      environment:
        http_proxy: http://proxy.example.com:8080

来自:playbooks_environment

© www.soinside.com 2019 - 2024. All rights reserved.