如何在 ansible playbook 中取消设置 http_proxy [英] how to unset http_proxy in ansible playbook

查看:28
本文介绍了如何在 ansible playbook 中取消设置 http_proxy的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在大多数ansible示例中,设置环境就像下面设置http_proxy一样,参见http://docs.ansible.com/playbooks_environment.html

In most ansible example, it is to set environment like setting http_proxy below, see http://docs.ansible.com/playbooks_environment.html

- hosts: all
  tasks:
  - apt: name=cobbler state=installed
    environment:
      http_proxy: http://proxy.example.com:8080

就我而言,我在系统 shell 中需要这个 http_proxy,而我想在 playbook 中禁用它,我该如何实现?

In my case, I need this http_proxy in system shell, while I want to disable this in playbook, how can I achieve this ?

如果我在 shell 中工作,我可以使用 unset http_proxy

If I work in shell, I can use unset http_proxy

推荐答案

您可以暂时禁用要与之对话的主机或 URL 的代理,例如

You could temporarily disable the proxy for the host(s) or URL you wanted to talk to, e.g.

environment:
  no_proxy: 192.168.1.2,www.google.com

这篇关于如何在 ansible playbook 中取消设置 http_proxy的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆