# Need assistance w/Fortinet playbook to list all AP's managed by device

**URL:** <https://forum.ansible.com/t/need-assistance-w-fortinet-playbook-to-list-all-aps-managed-by-device/3802>\
**Category:** Get Help\
**Tags:** playbook\
**Created:** [February 10, 2024, 12:37am UTC](https://forum.ansible.com/t/need-assistance-w-fortinet-playbook-to-list-all-aps-managed-by-device/3802 "2024-02-10T00:37:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![chr00ted](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/chr00ted/32/2188_2.png) [@chr00ted](https://forum.ansible.com/u/chr00ted)\
**Post date:** [February 10, 2024, 12:37am UTC](https://forum.ansible.com/t/need-assistance-w-fortinet-playbook-to-list-all-aps-managed-by-device/3802/1 "2024-02-10T00:37:30Z")

</div>

Hello all, I’m trying to write a playbook to query all Fortinet’s and give me a list of all Access points managed by that device.

I’ve been going off: [fortinet.fortios.fortios\_monitor\_fact module – Retrieve Facts of FortiOS Monitor Objects. — Ansible Documentation](https://docs.ansible.com/ansible/latest/collections/fortinet/fortios/fortios_monitor_fact_module.html)

But I’m not having to much look. I’ve tried several iterations of the following playbook. The result it does give is listing (1) AP, but I know for a fact that the current host I’m testing off has several APs. My preferred output would show AP model as well as firmware version. Below is my test playbook and below that will be some debug output

[https://docs.ansible.com/ansible/latest/collections/fortinet/fortios/fortios\_monitor\_fact\_module.html](https://docs.ansible.com/ansible/latest/collections/fortinet/fortios/fortios_monitor_fact_module.html)

- my code!

* * *

- hosts: all  
connection: httpapi  
gather\_facts: no  
vars:  
vdom: “root”  
ansible\_httpapi\_use\_ssl: yes  
ansible\_httpapi\_validate\_certs: no  
ansible\_httpapi\_port: 443  
ansible\_network\_os: fortinet.fortios.fortios  
tasks:
  - name: Gather FortiAPs firmware list  
fortinet.fortios.fortios\_monitor\_fact:  
vdom: “root”  
selector: wifi\_managed\_ap
  - debug:  
var: fortinet.fortios.fortios\_monitor\_fact

Debug output:  
ok: [10.1.1.27] =\> {  
“changed”: false,  
“invocation”: {  
“module\_args”: {  
“access\_token”: null,  
“enable\_log”: false,  
“filters”: null,  
“formatters”: null,  
“params”: null,  
“selector”: “wifi\_managed\_ap”,  
“selectors”: null,  
“sorters”: null,  
“vdom”: “root”  
}  
},  
“meta”: {  
“action”: “”,  
“build”: 1575,  
“http\_method”: “GET”,  
“name”: “managed\_ap”,  
“path”: “wifi”,  
“results”: [  
{  
“ap\_profile”: “FAP222C New”,  
“ble\_profile”: “”,  
“board\_mac”: “90:6c:ac:39:04:4c”,

Any help would be greatly appreciated

---

<div class="post-metadata">

**Author:** ![chr00ted](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/chr00ted/32/2188_2.png) [@chr00ted](https://forum.ansible.com/u/chr00ted)\
**Post date:** [February 24, 2024, 2:19pm UTC](https://forum.ansible.com/t/need-assistance-w-fortinet-playbook-to-list-all-aps-managed-by-device/3802/2 "2024-02-24T14:19:00Z")

</div>

I got it working with assistance from @MaxxLiu22 from Fortinet:

```auto
---
- hosts: all
  connection: httpapi
  gather_facts: no
  vars:
     vdom: "root"
     ansible_httpapi_use_ssl: yes
     ansible_httpapi_validate_certs: no
     ansible_httpapi_port: 444
     ansible_network_os: fortinet.fortios.fortios
  tasks:
  - name: Gather FortiAPs firmware list
    fortinet.fortios.fortios_monitor_fact:
      enable_log: true
      selector: 'wifi_managed_ap'
      vdom: "{{ vdom }}"
    register: result
  
  - debug:
      msg: "{{ result.meta.results | json_query('[].{wtp_id: wtp_id, status: status}') }}"

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [March 25, 2024, 2:19pm UTC](https://forum.ansible.com/t/need-assistance-w-fortinet-playbook-to-list-all-aps-managed-by-device/3802/3 "2024-03-25T14:19:08Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
