community.windows.win_http_proxy (2.2.0) — module

Manages proxy settings for WinHTTP

Authors: Jordan Borean (@jborean93)

Install collection

Install with ansible-galaxy collection install community.windows:==2.2.0


Add to requirements.yml

  collections:
    - name: community.windows
      version: 2.2.0

Description

Used to set, remove, or import proxy settings for Windows HTTP Services C(WinHTTP).

WinHTTP is a framework used by applications or services, typically .NET applications or non-interactive services, to make web requests.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Set a proxy to use for all protocols
  community.windows.win_http_proxy:
    proxy: hostname
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Set a proxy with a specific port with a bypass list
  community.windows.win_http_proxy:
    proxy: hostname:8080
    bypass:
    - server1
    - server2
    - <local>
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Set the proxy based on the IE proxy settings
  community.windows.win_http_proxy:
    source: ie
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Set a proxy for specific protocols
  community.windows.win_http_proxy:
    proxy:
      http: hostname:8080
      https: hostname:8443
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Set a proxy for specific protocols using a string
  community.windows.win_http_proxy:
    proxy: http=hostname:8080;https=hostname:8443
    bypass: server1,server2,<local>
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Remove any proxy settings
  community.windows.win_http_proxy:
    proxy: ''
    bypass: ''

Inputs

    
proxy:
    description:
    - A string or dict that specifies the proxy to be set.
    - If setting a string, should be in the form C(hostname), C(hostname:port), or C(protocol=hostname:port).
    - If the port is undefined, the default port for the protocol in use is used.
    - If setting a dict, the keys should be the protocol and the values should be the
      hostname and/or port for that protocol.
    - Valid protocols are C(http), C(https), C(ftp), and C(socks).
    - Omit, set to null or an empty string to remove the proxy settings.
    type: raw

bypass:
    description:
    - A list of hosts that will bypass the set proxy when being accessed.
    - Use C(<local>) to match hostnames that are not fully qualified domain names. This
      is useful when needing to connect to intranet sites using just the hostname.
    - Omit, set to null or an empty string/list to remove the bypass list.
    - If this is set then I(proxy) must also be set.
    elements: str
    type: list

source:
    choices:
    - ie
    description:
    - Instead of manually specifying the I(proxy) and/or I(bypass), set this to import
      the proxy from a set source like Internet Explorer.
    - Using C(ie) will import the Internet Explorer proxy settings for the current active
      network connection of the current user.
    - Only IE's proxy URL and bypass list will be imported into WinHTTP.
    - This is like running C(netsh winhttp import proxy source=ie).
    - The value is imported when the module runs and will not automatically be updated
      if the IE configuration changes in the future. The module will have to be run again
      to sync the latest changes.
    type: str

See also