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

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

问题描述

在最常见的示例中,它是像下面设置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

在我的情况下,我需要在系统外壳中使用此http_proxy,而我想在剧本中禁用它,如何实现呢?

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剧本中取消设置http_proxy的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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