Skip to main content
rwpatterson
New Member
November 13, 2020
Question

Has anyone successfully used Ansible with their Fortigates?

  • November 13, 2020
  • 2 replies
  • 22575 views

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.

    2 replies

    emnoc
    New Member
    November 13, 2020

    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

    rwpatterson
    New Member
    November 13, 2020

    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?

    emnoc
    New Member
    November 13, 2020

    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

    brookz
    New Member
    April 7, 2021

    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.