ftntcorecse / fndn_ansible

DEPRECATED - See New Ansible Galaxy Collections: https://galaxy.ansible.com/fortinet

Home Page:https://galaxy.ansible.com/fortinet

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

playbook test doesn't work

abraxxa opened this issue · comments

After searching for some hours and not finding a single hint about what might be wrong I hope I get help here.

OS: Ubuntu 19.10
Ansible 2.9.0 installed via official PPA
FortiManager installed on KVM locally in a NATed network
JSON RPC access is enabled for the admin user
Wireshark shows that Ansible isn't even trying to connect

Setting python2 or python3 didn't change anything but the deprecation warning, the error message from the module remains the same.

And finally here the error message:

PLAY [FMGR CONNECTION GET SYS STATUS] ****************************************************************************************************************************************************************************************************************************************************************************************

TASK [TEST FMGR CONNECTION GET SYS STATUS] ***********************************************************************************************************************************************************************************************************************************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ansible.module_utils.network.fortimanager.common.FMGBaseException: An attempt was made at communicating with a FMG with no valid session and an unexpected error was discovered.
[DEPRECATION WARNING]: Distribution Ubuntu 19.10 on host fmg should use /usr/bin/python3, but is using /usr/bin/python for backward compatibility with prior Ansible releases. A future Ansible release will default to using the discovered platform python for this host. See 
https://docs.ansible.com/ansible/2.9/reference_appendices/interpreter_discovery.html for more information. This feature will be removed in version 2.12. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.
fatal: [fmg]: FAILED! => {"ansible_facts": {"discovered_interpreter_python": "/usr/bin/python"}, "changed": false, "module_stderr": "Traceback (most recent call last):\n  File \"/home/ahartmai/.ansible/tmp/ansible-local-18830lpQ1iC/ansible-tmp-1573668092.64-29563260635049/AnsiballZ_fmgr_query.py\", line 102, in <module>\n    _ansiballz_main()\n  File \"/home/ahartmai/.ansible/tmp/ansible-local-18830lpQ1iC/ansible-tmp-1573668092.64-29563260635049/AnsiballZ_fmgr_query.py\", line 94, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n  File \"/home/ahartmai/.ansible/tmp/ansible-local-18830lpQ1iC/ansible-tmp-1573668092.64-29563260635049/AnsiballZ_fmgr_query.py\", line 40, in invoke_module\n    runpy.run_module(mod_name='ansible.modules.network.fortimanager.fmgr_query', init_globals=None, run_name='__main__', alter_sys=False)\n  File \"/usr/lib/python2.7/runpy.py\", line 192, in run_module\n    fname, loader, pkg_name)\n  File \"/usr/lib/python2.7/runpy.py\", line 72, in _run_code\n    exec code in run_globals\n  File \"/tmp/ansible_fmgr_query_payload_4gMw5r/ansible_fmgr_query_payload.zip/ansible/modules/network/fortimanager/fmgr_query.py\", line 431, in <module>\n  File \"/tmp/ansible_fmgr_query_payload_4gMw5r/ansible_fmgr_query_payload.zip/ansible/modules/network/fortimanager/fmgr_query.py\", line 425, in main\nansible.module_utils.network.fortimanager.common.FMGBaseException: An attempt was made at communicating with a FMG with no valid session and an unexpected error was discovered.\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}

PLAY RECAP *******************************************************************************************************************************************************************************************************************************************************************************************************************
fmg                        : ok=0    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0

Thanks!

Downgrading Ansible to 2.8.7 fixed the issue.
Please inform us when your module is fixed and compatible with Ansible 2.9.
Thanks!

We've updated the httpapi plugin to adjust for a connection change that was introduced in 2.9.

https://github.com/ftntcorecse/fndn_ansible/blob/master/fortimanager/plugins/httpapi/fortimanager.py

It's on our FNDN repo for now, and is currently in PR.

Hello @ftntcorecse
is your fix already included in an ansible version?

@awuetz The PR has been approved -- it will be in version 2.10 when it is released. If you're so inclined you can also pick it up off the devel branch of the Ansible repo itself.