fortinet-ansible-dev / ansible-galaxy-fortios-collection

GNU General Public License v3.0
84 stars 48 forks source link

"couldn't resolve module/action 'fortios_configuration_fact' #200

Closed ebenitezj closed 1 year ago

ebenitezj commented 1 year ago

Hi all,

When I run AWX:

FAILED! => {"reason": "couldn't resolve module/action 'fortios_configuration_fact'. This often indicates a misspelling, missing collection, or incorrect module path.

My Fortigate have 6.4.5 version and galaxy collection is 2.1.5

In AWX I have a Template that calls comms/backup_config_prueba.yml image

backup_config_prueba.yaml:

role backup_config


I dont know why my playbook doesn't work

MaxxLiu22 commented 1 year ago

Hi @ebenitezj ,

Thank you for raising this issue. From the error msg, there would be some inappropriate format around. From the configuration you provide, there would be an extra space before the arguments 'selector' and 'vdom', since they are sub-arguments of fortios_configuraton_fact,

- hosts: fortigates
  connection: httpapi
  collections:
    - fortinet.fortios
  vars:
    ansible_httpapi_use_ssl: yes
    ansible_httpapi_validate_certs: no
    ansible_httpapi_port: 443
    vdom: "root"
  tasks:
  - name: Extracción de configuración
    fortios_configuration_fact:
      access_token: "token"
      enable_log: "yes"
      vdom: "global"
      selector: 'system_global'

if that not fix the problem, you can try to upgrade fortinet.fortios to latest version by run ansible-galaxy collection install fortinet.fortios:2.1.7

Thanks, Maxx

ebenitezj commented 1 year ago

Hi @ebenitezj ,

Thank you for raising this issue. From the error msg, there would be some inappropriate format around. From the configuration you provide, there would be an extra space before the arguments 'selector' and 'vdom', since they are sub-arguments of fortios_configuraton_fact,

- hosts: fortigates
  connection: httpapi
  collections:
    - fortinet.fortios
  vars:
    ansible_httpapi_use_ssl: yes
    ansible_httpapi_validate_certs: no
    ansible_httpapi_port: 443
    vdom: "root"
  tasks:
  - name: Extracción de configuración
    fortios_configuration_fact:
      access_token: "token"
      enable_log: "yes"
      vdom: "global"
      selector: 'system_global'

if that not fix the problem, you can try to upgrade fortinet.fortios to latest version by run ansible-galaxy collection install fortinet.fortios:2.1.7

Thanks, Maxx

ebenitezj commented 1 year ago

Hi @MaxxLiu22 ,

Sorry for late reply.

When I run the fortigate playbook without roles it works correctly:

When I run the fortigate playbook with roles doesn't work properly: image image image

It shows the following output when I run the template: image

I have the following fortigate collection: image

What could be the problem?

Thank you very much

markus2066 commented 1 year ago

I am also experiencing the same issue when attempting to utilise either the "fortios_system_virtual_switch" or "fortios_configuration_fact" in a task as part of a role (working fine within a standard playbook).

ERROR! couldn't resolve module/action 'fortios_configuration_fact'. This often indicates a misspelling, missing collection, or incorrect module path.

ERROR! couldn't resolve module/action 'fortios_system_virtual_switch'.

Software versions: ansible [core 2.13.7rc1] Fortios 7.0.9 fortinet.fortios 2.2.2

Thanks Mark

MaxxLiu22 commented 1 year ago

Hi @ebenitezj @markus2066 ,

I can reproduce this issue when using roles method, have reported it to the development team. I will let you know if there is any update.

Thanks, Maxx

markus2066 commented 1 year ago

Thanks Maxx

vincent-at-forti commented 1 year ago

Hello,

When using roles, you may need to add collection dependencies in the meta/main.yml file. At the end , add the following:

collections:
  - fortinet.fortios

Hope it helps. Best Regards Vincent