FortiGate
FortiGate Next Generation Firewall utilizes purpose-built security processors and threat intelligence security services from FortiGuard labs to deliver top-rated protection and high performance, including encrypted traffic.
Anonymous
Not applicable
Article Id 344330
Description This article describes the behavior of FortiGate when continuously invoking HTTP calls through Ansible scripts and how to fix it.
Scope FortiGate, Ansible.
Solution

In case the ansible script contains a single task or multiple tasks that can take around 5 minutes or more to complete, and a REST API admin is configured with traditional credentials of user and password, then users will observe the logs below on FortiGate.


ansible login_failed.png
On the ansible script, the error displayed will be '429 Too Many Requests'. This occurs because FortiGate will automatically apply a rate limit when the amount of HTTP requests received reaches around the 5-minute mark of the script continuously running, even though previous tasks run successfully.


ansible_error.png

The solution is to use a REST API administrator API Key following the documentation below and make sure the API Key is placed into the host file attribute fortios_access_token plus inside the task or YAML files depending on the programming structure.

The article: Technical Tip: Application of Ansible on FortiGate contains a few structural examples.


Related articles:
REST API administrator
Technical Tip: How to create a REST API Admin user and assign it to an admin profile

Technical Tip: Application of Ansible on FortiGate

Contributors