Configuring Fortigate Firewall Interfaces from a CSV file using Ansible

Configuring Fortigate Firewall Interfaces from a CSV file using Ansible

In continuation of my previous article where we configured two firewall sub-interfaces through Ansible; we are further going to optimize it to use a loop and fetch data from a csv file to create multiple sub-interfaces on fortigate firewall. Below is the CSV file we are going to use for this example by storing their values in key-value pairs.

No alt text provided for this image

Now we are going to use Ansible read_csv module and register the output in variable readintf. You can also display the content of csv file by using debug module which we are not going to use in this example.

No alt text provided for this image

Once read operation is completed, we are going to use the same fortios_system_interface and instead of giving static values we will fetch csv file values in relevant fields and loop this module till all values stored in readintf variable are retrieved.

No alt text provided for this image

Let’s run this code now and see the results.

No alt text provided for this image
No alt text provided for this image
Ashfaq A.

Sr. Network Infrastructure Engineer

2 年

Nice ??

回复

要查看或添加评论,请登录

Muhammad Awais Butt的更多文章

  • Configuring Fortigate Firewall Interfaces with Ansible

    Configuring Fortigate Firewall Interfaces with Ansible

    In this article we are going to configure Fortigate firewall Interfaces through Ansible. In the demo below, we have a…

    1 条评论
  • How I Cracked My CISM Exam

    How I Cracked My CISM Exam

    Hello Everyone, The purpose of this document is to write down my strategy of clearing my Certified Information Security…

    7 条评论
  • UPGRADING CISCO NEXUS SWITCHES VIA USB PORT

    UPGRADING CISCO NEXUS SWITCHES VIA USB PORT

    PROBLEM STATEMENT : Recent Cisco Nexus software images are huge ( around 01 to 02 Gig) in size and uploading them to…

    13 条评论
  • Cleared DEVASC Exam {"200":"901"}

    Cleared DEVASC Exam {"200":"901"}

    So finally, I have cleared the Devnet Associate exam which I have been preparing since Cisco formally announced for…

  • HOW I CRACKED MY CISSP @10 JAN 19

    HOW I CRACKED MY CISSP @10 JAN 19

    Hi Guys, My name is Muhammad Awais and I provisionally passed CISSP exam on 10th Jan. 2019 (maybe the Jan.

    8 条评论

社区洞察

其他会员也浏览了