ansible / network

Ansible collection for network devices
16 stars 16 forks source link

fmgr_fwobj_address Module not working in Ansible 2.9 #46

Open Sethueha opened 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. It gives an error MODULE FAILURE\nSee stdout/stderr for the exact error.

ISSUE TYPE Bug Report COMPONENT NAME fmgr_fwobj_address

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]

CONFIGURATION DEFAULT_TIMEOUT(/etc/ansible/ansible.cfg) = 30 HOST_KEY_CHECKING(/etc/ansible/ansible.cfg) = False PARAMIKO_HOST_KEY_AUTO_ADD(/etc/ansible/ansible.cfg) = True PARAMIKO_LOOK_FOR_KEYS(/etc/ansible/ansible.cfg) = False PERSISTENT_COMMAND_TIMEOUT(/etc/ansible/ansible.cfg) = 60 OS / ENVIRONMENT NAME="Ubuntu" VERSION="16.04.1 LTS (Xenial Xerus)" ID=ubuntu ID_LIKE=debian PRETTY_NAME="Ubuntu 16.04.1 LTS" VERSION_ID="16.04" HOME_URL="http://www.ubuntu.com/" SUPPORT_URL="http://help.ubuntu.com/" BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/" UBUNTU_CODENAME=xenial

STEPS TO REPRODUCE Playbook:

hosts: FortiManager connection: httpapi gather_facts: False tasks: name: Create address object in Fortimanager fmgr_fwobj_address: adom: "Global" name: test ipv4: ipmask ipv4addr: 10.10.10.10/32 associated_interface: any color: 4 mode: add

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 It should configure the address object in Forti manager device.

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