networktocode / fortimanager-ansible

Ansible Modules to manage Fortinet FortiManager
Other
65 stars 34 forks source link

fmgr_fwobj_address Module not working in Ansible 2.9 - MODULE FAILURE\nSee stdout/stderr for the exact error" #80

Closed Sethueha closed 4 years ago

Sethueha commented 4 years ago

Summary:

I have an Fortimanager VM with trail license running on it. I'm trying to configure address in device using fmgr_fwobj_address module, but it is not working. I have super user access to Fortimanager and able to do SSH from Ansible server.

Ansible version:

ansible 2.9.1 config file = /etc/ansible/ansible.cfg configured module search path = [u'/home/sysadmin/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules'] ansible python module location = /usr/lib/python2.7/dist-packages/ansible executable location = /usr/bin/ansible python version = 2.7.12 (default, Nov 12 2018, 14:36:49) [GCC 5.4.0 20160609]

STEPS TO REPRODUCE Playbook:


Inventory file:

[FortiManager] 172.20.32.200 ansible_host=172.20.32.200

[fmgr_api:children] FortiManager

[fmgr_api:vars] ansible_network_os=fortimanager ansible_user=admin ansible_password=admin ansible_become=no ansible_become_method=disable ansible_httpapi_use_ssl=true ansible_httpapi_validate_certs=false ansible_httpapi_timeout=300

EXPECTED RESULTS: The playbook should configure the address in Fortimanager

ACTUAL RESULTS:

fatal: [172.20.32.200]: FAILED! => { "ansible_facts": { "discovered_interpreter_python": "/usr/bin/python" }, "changed": false, "module_stderr": "Traceback (most recent call last):\n File \"/home/sysadmin/.ansible/tmp/ansible-local-252351JU_df/ansible-tmp-1574851380.58-52172427055422/AnsiballZ_fmgr_fwobj_address.py\", line 102, in \n _ansiballz_main()\n File \"/home/sysadmin/.ansible/tmp/ansible-local-252351JU_df/ansible-tmp-1574851380.58-52172427055422/AnsiballZ_fmgr_fwobj_address.py\", line 94, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File \"/home/sysadmin/.ansible/tmp/ansible-local-252351JU_df/ansible-tmp-1574851380.58-52172427055422/AnsiballZ_fmgr_fwobj_address.py\", line 40, in invoke_module\n runpy.run_module(mod_name='ansible.modules.network.fortimanager.fmgr_fwobj_address', init_globals=None, run_name='main', alter_sys=True)\n File \"/usr/lib/python2.7/runpy.py\", line 188, in run_module\n fname, loader, pkg_name)\n File \"/usr/lib/python2.7/runpy.py\", line 82, in _run_module_code\n mod_name, mod_fname, mod_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_fwobj_address_payload_gjnAbb/ansible_fmgr_fwobj_address_payload.zip/ansible/modules/network/fortimanager/fmgr_fwobj_address.py\", line 668, in \n File \"/tmp/ansible_fmgr_fwobj_address_payload_gjnAbb/ansible_fmgr_fwobj_address_payload.zip/ansible/modules/network/fortimanager/fmgr_fwobj_address.py\", line 658, 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

Sethueha commented 4 years ago

Hi Team,

Please provide the update ASAP.

itdependsnetworks commented 4 years ago

A few things to consider.

jmcgill298 commented 4 years ago

These modules do not support the httpapi connection plugin; you will need to either use a token or basic auth for each task

Sethueha commented 4 years ago

I have referred to the link below and they have mentioned to use httpapi instead of connection local. The basic auth doesn't work with this module because it don't have option to enter host, username and password. Could you please provide one example how we have to use this,

https://ftnt-ansible-docs.readthedocs.io/en/latest/fmgr_getting_started.html

jmcgill298 commented 4 years ago

The modules that link refers to are not related to this project, and looking back at your example, the module you are using is not part of this project. Please raise an issue with Ansible