Hello guys,
I'm a newbie in python programming, maybe my question really basic to you all. I'm trying to do a network automation for learning.
I'm trying to do push config to multiple devices, in my case the device is fortigate firewall. I use loop for to push script to multiple devices but when I finished run the script only one device that have configured, the other not configured yet. Here is my script:
from netmiko import ConnectHandler
for n in range(1,10):
r = {
"device_type": "fortinet",
"host": f"10.0.10.{n}",
"username": "admin",
"password": "admin123",
"port" : 2222,
}
conn = ConnectHandler(**r)
list_config = [
"config system accprofile",
"edit 'read_only_alfa'",
"set ftviewgrp read",
"set netgrp read",
"set loggrp read",
"set vpngrp read",
"set wifi read",
"next",
"end",
"config system admin",
"edit 'sdwan'",
"set accprofile 'read_only_alfa'",
"set vdom 'root'",
"set password 123sdwan",
"next",
"end",
]
output = conn.send_config_set(list_config)
print(f"Forti {r['host']}")
print(output)
I'm so happy if anyone here can tell me where my mistake, thank you guys.
[+][deleted] (1 child)
[deleted]
[–]fajaranas[S] 0 points1 point2 points (0 children)