Coder Social home page Coder Social logo

qingchen1984 / ansible-role-win_netroute Goto Github PK

View Code? Open in Web Editor NEW

This project forked from informatique-cdc/ansible-role-win_netroute

0.0 1.0 0.0 40 KB

Ansible module to add or remove an IP route in the IP routing table on Windows-based systems.

License: GNU General Public License v3.0

PowerShell 82.94% Python 15.04% Dockerfile 2.03%

ansible-role-win_netroute's Introduction

win_netroute - Adds or removes an IP route in the IP routing table

Synopsis

  • Ansible module to add or remove an IP route in the IP routing table on Windows-based systems.

Parameters

Parameter Choices/Defaults Comments
interface_alias
string
Alias of a network interface.
The module adds or removes a route for the interface that has the alias that you specify.
If interface_alias is not provided and gateway is provided, the module uses the [Find-NetRoute] cmdlet to determine the value of interface_alias.
destination
string / required
Destination IP address in CIDR format (ip address/prefix length).
gateway
string
Gateway used by the static route.
If gateway and interface_alias are not provided it will be set to 0.0.0.0.
If gateway is not provided it will be set to the gateway defined for interface_alias.
metric
integer
Default:
1
Metric used by the static route.
state
string
Choices:
  • absent
  • present ←
If absent, it removes a network static route.
If present, it adds a network static route.

Examples

---
---
  roles:
    - win_netroute

  tasks:

    - name: Add a network static route
      win_netroute:
        interface_alias: eth1
        destination: 192.168.2.10/32
        gateway: 192.168.1.1
        metric: 1
        state: present

    - name: Add a network static route by using the gateway of the network interface
      win_netroute:
        interface_alias: eth1
        destination: 192.168.2.10/32
        metric: 1
        state: present

    - name: Add a network static route by using 0.0.0.0 as gateway
      win_netroute:
        destination: 192.168.2.10/32
        metric: 1
        state: present

    - name: Remove a network static route by using the gateway
      win_netroute:
        destination: 192.168.2.10/32
        state: absent
        gateway: 192.168.1.1

    - name: Remove a network static route by using the interface alias
      win_netroute:
        interface_alias: eth1
        destination: 192.168.2.10/32
        state: absent

    - name: Remove a network static route
      win_netroute:
        destination: 192.168.2.10/32
        state: absent

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key Returned Description
destination
string
always The destination IP address in CIDR format.

Sample:
192.168.2.10/32
gateway
string
always The gateway used by the static route.

Sample:
192.168.1.1
interface_alias
string
always The alias of a network interface used for the static route.

Sample:
eth1
metric
integer
always The metric used by the static route.

Sample:
16
output
string
always A message describing the task result.

Sample:
Route added
state
string
always The state of the IP route.

Sample:
present

Notes

  • Works only with Windows 2012 R2 and newer.
  • This module is a fork of the [win_route] module.
  • This module allows to add or remove a route for the interface that has the alias that you specify.
  • This module automatically calculates the gateway as a network interface when it does not have one by default.
  • This module allows you to modify the characteristics of a route that already exists (metric, gateway or interface).

Authors

  • Stéphane Bilqué (@sbilque) - fork of win_route
  • Daniele Lazzari ([email protected])- creator of win_route

License

This project is licensed under the GNU General Public License v3.0 License.

See LICENSE to see the full text.

ansible-role-win_netroute's People

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.