Skip to main content
rwpatterson
New Member
Nov 13, 2020 4:21 PM UTC
Question

Has anyone successfully used Ansible with their Fortigates?

I have just finished an Ansible class for my job (switches and such) and was trying to connect with my Fortigate. No Bueno! Anyone have any luck using Ansible to connect to their Fortigate?

 

Thanks in advance.

    12 replies

    emnoc
    New Member
    Nov 13, 2020 4:52 PM UTC

    Yes, Have you confirm that ssh & https access is available from the managed node to the fortigate? I would pull up a cli and do a test run.

    e.g 

     

    ssh username@fgt.ipv4

    curl -v -k https::<fgt address>

     

     

    Ensure if trusthost is being used that this is not blocking the access.

     

    Ken Felix

    Translate
    rwpatterson
    New Member
    Nov 13, 2020 5:28 PM UTC

    Been there, done that. I can get in from the CLI. Maybe I just can't write a proper playbook. Do you have  an example that would say get me the contents of the 'system' 'interfaces' area?

    Translate
    emnoc
    New Member
    Nov 13, 2020 6:34 PM UTC

    basic play book for status collecting against my hosts in fgtwest . You need to ensure the creds are correct which I assume you did .

     

     

    =====ensure you have the proper indexing ======

    - hosts: localhost vars: host: "fgtwest username: "fgtadmin" password: "fgtpassword1234" vdom: "root" ssl_verify: "no"

    tasks: - name:  basic system status f  fortios_facts: host: "{{ host }}" username: "{{ username }}" password: "{{ password }}" vdom: "{{ vdom }}" gather_subset: - fact: 'system_status_select'

     

     

    Ken Felix

    Translate
    brookz
    New Member
    Apr 7, 2021 2:40 PM UTC

    Look at Ansible Galaxy... there is a collection of FortiOS and Fortimanager modules available for download. If you're already figured that out, great. The documentation isn't the greatest. Struggling through some things with it myself. 

    Translate
    Risk and Resilience in the Age of AI. An OT Thought Leadership Summit for Houston's Critical Infrastructure Leaders. Date: Thursday, December 3, 2026. Time: 8:30 am - 1:30 pm (CT). Location: The Westin Houston, Memorial City | 945 Gessner Road, Houston, TX 77024