Ansible uri不';不支持本地主机代理设置
我试图通过不同的代理服务器从Ansible主机发送多个URI请求。 清单包含要使用的代理服务器,但所有服务器都应该从localhost运行。 但是,当我运行下面的剧本时,Ansible和URI始终使用相同的系统(!)代理设置,无论基于任务的代理设置是什么: ansible版本2.9.2Ansible uri不';不支持本地主机代理设置,ansible,uri,Ansible,Uri,我试图通过不同的代理服务器从Ansible主机发送多个URI请求。 清单包含要使用的代理服务器,但所有服务器都应该从localhost运行。 但是,当我运行下面的剧本时,Ansible和URI始终使用相同的系统(!)代理设置,无论基于任务的代理设置是什么: ansible版本2.9.2 - hosts: all gather_facts: no connection: local ignore_errors: yes tasks: - name: Check
- hosts: all
gather_facts: no
connection: local
ignore_errors: yes
tasks:
- name: Check HTTP 200 return authenticated connection to proxy
uri:
url: "https://api.ipify.org?format=json"
status_code: 200
return_content: yes
body_format: json
timeout: 5
register: result
delegate_to: localhost
environment:
http_proxy: "http://user:pwd@{{ inventory_hostname }}"
https_proxy: "http://user:pwd@{{ inventory_hostname }}"
@β、 εηοιτ.βε
local_action
只是delegate_to:localhost
()的一种“速记”语法。我加引号是因为我个人觉得这个符号非常混乱,而且我从不使用它。就我而言,上述功能应该可以正常工作。您可以在您的游戏中删除连接:local
,然后再试一次吗?这将强制所有主机的本地连接。如果没有明确定义,则localhost是隐式的,使用本地连接,并且与all
组()不匹配