community.windows.win_route (2.2.0) — module

Add or remove a static route

Authors: Daniele Lazzari (@dlazz)

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

Add or remove a static route.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
---
- name: Add a network static route
  community.windows.win_route:
    destination: 192.168.2.10/32
    gateway: 192.168.1.1
    metric: 1
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Remove a network static route
  community.windows.win_route:
    destination: 192.168.2.10/32
    state: absent

Inputs

    
state:
    choices:
    - absent
    - present
    default: present
    description:
    - If C(absent), it removes a network static route.
    - If C(present), it adds a network static route.
    type: str

metric:
    default: 1
    description:
    - Metric used by the static route.
    type: int

gateway:
    description:
    - The gateway used by the static route.
    - If C(gateway) is not provided it will be set to C(0.0.0.0).
    type: str

destination:
    description:
    - Destination IP address in CIDR format (ip address/prefix length).
    required: true
    type: str

Outputs

output:
  description: A message describing the task result.
  returned: always
  sample: Route added
  type: str