Trying run playbook on fortigate firewalls, getting api error

moinshaikh.sa
Fri, 06 Sep 2024 19:46:39 +0000
Get Help

Hi Experts,

i am new to anisble, i am trying to run playbook against fortigate firewall to get the list of policies which are having zero hits.

ansible - 2.17.1
python 2.11.9

Below mentioned are my host file and playbook, when i run it i am getting error
fatal: [FW1]: FAILED! => {“msg”: “unable to load API plugin for platform type fortinet.fortios”}

[fortigates]
FW1 ansible_host=10.10.10.10 ansible_user=“test” ansible_password=“Aa123123”

hosts: FW1
connection: httpapi
vars:
ansible_httpapi_use_ssl: yes
ansible_httpapi_validate_certs: no
ansible_network_os: fortinet.fortios
tasks:

name: Get all firewall policies
fortinet.fortios.fortios_firewall_policy:
vdom: “root”
state: “gathered”
register: policies

name: Print policies with zero hits
debug:
msg: “Policy ID: {{ item.policyid }} has zero hits”
loop: “{{ policies[‘ansible_facts’] [‘fortios_firewall_policy’] }}”
when: item.hit_count == 0
~

1 post - 1 participant