(The full traceback is: Traceback (most recent call last): File "/root/.ansible/tmp/ansible-local-19420cw_tddj5/ansible-tmp-1731094291.3454626-19423-6313868603234/AnsiballZ_fmgr_fact.py", line 107, in <module> _ansiballz_main() File "/root/.ansible/tmp/ansible-local-19420cw_tddj5/ansible-tmp-1731094291.3454626-19423-6313868603234/AnsiballZ_fmgr_fact.py", line 99, in _ansiballz_main invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS) File "/root/.ansible/tmp/ansible-local-19420cw_tddj5/ansible-tmp-1731094291.3454626-19423-6313868603234/AnsiballZ_fmgr_fact.py", line 47, in invoke_module runpy.run_module(mod_name='ansible_collections.fortinet.fortimanager.plugins.modules.fmgr_fact', init_globals=dict(_module_fqn='ansible_collections.fortinet.fortimanager.plugins.modules.fmgr_fact', _modlib_path=modlib_path), File "/usr/lib/python3.10/runpy.py", line 224, in run_module return _run_module_code(code, init_globals, run_name, mod_spec) File "/usr/lib/python3.10/runpy.py", line 96, in _run_module_code _run_code(code, mod_globals, init_globals, File "/usr/lib/python3.10/runpy.py", line 86, in _run_code exec(code, run_globals) File "/tmp/ansible_fortinet.fortimanager.fmgr_fact_payload_5lufrst1/ansible_fortinet.fortimanager.fmgr_fact_payload.zip/ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_fact.py", line 11282, in <module> File "/tmp/ansible_fortinet.fortimanager.fmgr_fact_payload_5lufrst1/ansible_fortinet.fortimanager.fmgr_fact_payload.zip/ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_fact.py", line 11276, in main File "/tmp/ansible_fortinet.fortimanager.fmgr_fact_payload_5lufrst1/ansible_fortinet.fortimanager.fmgr_fact_payload.zip/ansible_collections/fortinet/fortimanager/plugins/module_utils/napi.py", line 182, in __init__ File "/tmp/ansible_fortinet.fortimanager.fmgr_fact_payload_5lufrst1/ansible_fortinet.fortimanager.fmgr_fact_payload.zip/ansible_collections/fortinet/fortimanager/plugins/module_utils/napi.py", line 205, in process_workspace_lock File "/tmp/ansible_fortinet.fortimanager.fmgr_fact_payload_5lufrst1/ansible_fortinet.fortimanager.fmgr_fact_payload.zip/ansible/module_utils/connection.py", line 199, in __rpc__ ansible.module_utils.connection.ConnectionError: Method not found fatal: [fortimanager1]: FAILED! => { "changed": false, "module_stderr": "Traceback (most recent call last):\n File \"/root/.ansible/tmp/ansible-local-19420cw_tddj5/ansible-tmp-1731094291.3454626-19423-6313868603234/AnsiballZ_fmgr_fact.py\", line 107, in <module>\n _ansiballz_main()\n File \"/root/.ansible/tmp/ansible-local-19420cw_tddj5/ansible-tmp-1731094291.3454626-19423-6313868603234/AnsiballZ_fmgr_fact.py\", line 99, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File \"/root/.ansible/tmp/ansible-local-19420cw_tddj5/ansible-tmp-1731094291.3454626-19423-6313868603234/AnsiballZ_fmgr_fact.py\", line 47, in invoke_module\n runpy.run_module(mod_name='ansible_collections.fortinet.fortimanager.plugins.modules.fmgr_fact', init_globals=dict(_module_fqn='ansible_collections.fortinet.fortimanager.plugins.modules.fmgr_fact', _modlib_path=modlib_path),\n File \"/usr/lib/python3.10/runpy.py\", line 224, in run_module\n return _run_module_code(code, init_globals, run_name, mod_spec)\n File \"/usr/lib/python3.10/runpy.py\", line 96, in _run_module_code\n _run_code(code, mod_globals, init_globals,\n File \"/usr/lib/python3.10/runpy.py\", line 86, in _run_code\n exec(code, run_globals)\n File \"/tmp/ansible_fortinet.fortimanager.fmgr_fact_payload_5lufrst1/ansible_fortinet.fortimanager.fmgr_fact_payload.zip/ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_fact.py\", line 11282, in <module>\n File \"/tmp/ansible_fortinet.fortimanager.fmgr_fact_payload_5lufrst1/ansible_fortinet.fortimanager.fmgr_fact_payload.zip/ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_fact.py\", line 11276, in main\n File \"/tmp/ansible_fortinet.fortimanager.fmgr_fact_payload_5lufrst1/ansible_fortinet.fortimanager.fmgr_fact_payload.zip/ansible_collections/fortinet/fortimanager/plugins/module_utils/napi.py\", line 182, in __init__\n File \"/tmp/ansible_fortinet.fortimanager.fmgr_fact_payload_5lufrst1/ansible_fortinet.fortimanager.fmgr_fact_payload.zip/ansible_collections/fortinet/fortimanager/plugins/module_utils/napi.py\", line 205, in process_workspace_lock\n File \"/tmp/ansible_fortinet.fortimanager.fmgr_fact_payload_5lufrst1/ansible_fortinet.fortimanager.fmgr_fact_payload.zip/ansible/module_utils/connection.py\", line 199, in __rpc__\nansible.module_utils.connection.ConnectionError: Method not found\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1 }
)
fortimanager-script.yml
- name: Test FortiManager Connection
hosts: fortimanagers
connection: httpapi
gather_facts: false
vars:
ansible_httpapi_use_ssl: true
ansible_httpapi_validate_certs: false
ansible_httpapi_port: 443
tasks:
- name: Get system status
fortinet.fortimanager.fmgr_fact:
facts:
selector: "sys_status"
inventory.ini
[fortimanagers]
fortimanager1 ansible_host=10.10.10.10
[fortimanagers:vars]
ansible_connection=httpapi
ansible_httpapi_use_ssl=true
ansible_httpapi_validate_certs=false
ansible_httpapi_port=443
ansible_user=Admin
ansible_password=Password
ansible --version
19460 1731095229.74235: starting run
ansible [core 2.17.3]
config file = None
configured module search path = [‘/root/.ansible/plugins/modules’, ‘/usr/share/ansible/plugins/modules’]
ansible python module location = /usr/local/lib/python3.10/dist-packages/ansible
ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
executable location = /usr/local/bin/ansible
python version = 3.10.12 (main, Sep 11 2024, 15:47:36) [GCC 11.4.0] (/usr/bin/python3)
jinja version = 3.0.3
libyaml = True