---
- name: modifyRoutes
gather_facts: no
connection: local
hosts: ASA
vars:
action: StaticRouteAddition
contextname: fw-automation-test
interfacename: ['interface port-channel 35.3102']
interfacename2: port-channel 35.3102
ip: 192.168.101.101
mask: 255.255.255.0
speedmode: auto
duplexmode: auto
securityinterfacename: inside
securitylevelnumber: 0
devicetype: ciscoASA
routeModificationType: addition
routeMode:
hostIPAddress: 192.168.101.101
hostIPMask: 255.255.255.0
nextHopIP: 192.168.102.102
adminDistance: 10
destIPAddress:
destIPMask:
destGatewayIPAddress:
distanceValue:
comments:
cli:
host:
username:
password:
auth_pass:
authorize: yes
timeout: 100
tasks:
- name: StaticRouteAddition
when: action == "StaticRouteAddition" and devicetype == "ciscoASA"
asa_config:
context: "{{contextname}}"
commands:
- "route {{interfacename2}} {{hostIPAddress}} {{hostIPMask}} {{nextHopIP}} {{adminDistance}}"
provider: "{{ cli }}"
- name: StaticRouteDeletion
when: action == "StaticRouteDeletion" and devicetype == "ciscoASA"
asa_config:
context: "{{contextname}}"
commands:
- "no route {{interfacename2}} {{hostIPAddress}} {{hostIPMask}} {{nextHopIP}} {{adminDistance}}"
provider: "{{ cli }}"