fortinet-ansible-dev / ansible-galaxy-fortimanager-collection

GNU General Public License v3.0
16 stars 16 forks source link

Add filter support for fmgr_fact fmg_variable_dynamicmapping param. #89

Closed cr0cdev closed 2 months ago

cr0cdev commented 2 months ago

Hi!

Could you also add "filter" support for fmgr_fact module fmg_variable_dynamicmapping param. When looking at the API documentation I can see that filter should be supported. Would it be possible to add it?

Thanks!

dux-fortinet commented 2 months ago

Hi @cr0cdev ,

Currently FortiManager Ansible fmgr_fact module already supports filter. I can use the following script to get results correctly with the "filter" specified:

- name: Github89
  hosts: fortimanagers
  connection: httpapi
  vars:
    ansible_httpapi_use_ssl: true
    ansible_httpapi_validate_certs: false
    ansible_httpapi_port: 443
  tasks:
    - name: Get fact
      fortinet.fortimanager.fmgr_fact:
        facts:
          filter: ["value", "==", "string"]
          selector: "fmg_variable_dynamicmapping"
          params:
            adom: "root"
            variable: test
            # dynamic_mapping: "FGVMMLTM00000000/root" # Optional parameter, "<your deive name>/<your device vodm>"
      register: response
    - name: Display response
      debug:
        var: response

Please feel free to let me know if you have any questions.

Best, Dux