Closed shokrymohamedshokry closed 1 year ago
Hi @shokrymohamedshokry ,
Thank you for your question, ansible use argument "seq_num" as a key to locate the static route item, if that is not set, system would add a new static router instead. Could you try the following code, if you still encounter any issue, feel free to let me know
- hosts: fortigate05
collections:
- fortinet.fortios
connection: httpapi
vars:
vdom: "In-Out"
ansible_httpapi_use_ssl: yes
ansible_httpapi_validate_certs: no
ansible_httpapi_port: 8443
tasks:
- name: Configure IPv4 static routing tables.
fortios_router_static:
vdom: "{{ vdom }}"
state: "present"
access_token: "{{ fortios_access_token2 }}"
router_static:
seq_num: 2 # static router you want to edit
comment: "Hello from ansible"
device: "TEST"
distance: "10"
dst: "1.1.1.1/255.255.255.255"
gateway: "172.1.1.1"
status: "enable"
Thanks, Maxx
Thanks Max Could you please help me how to find the static route "seq_num" from FortiGate interface?
thanks
I'm trying this command get system route 5
to get seq_num on FortiGate CLi but not working with me it's give me the below
DR-Perimeter-FWFG-301E $ get system route 5
command parse error before 'route'
Command fail. Return code -61
solved now after make the following on forti Terminal
config vdom
edit In-Out
show router static | grep -B 2 -A 3 <IP>
thanks
How can i edit on static route, every time i run the playbook it's create a new static route, how can i modify not to create a new one
Example of playbook
For Example, if i need the status to be disable and change
status: "enable"
tostatus: "disable"
it will create a new static with disable state.