ansible-collections / ansible.netcommon

Ansible Network Collection for Common Code
GNU General Public License v3.0
143 stars 104 forks source link

File "/tmp/ansible_fortios_monitor_fact_payload_v68501bf/ansible_fortios_monitor_fact_payload.zip/ansible/module_utils/connection.py", line 199, in __rpc__ ansible.module_utils.connection.ConnectionError: Requested entry (plugin_type: connection plugin: ansible_collections.ansible.netcommon.plugins.connection.httpapi setting: access_token ) was not defined in configuration. #659

Closed filterfilter closed 3 months ago

filterfilter commented 4 months ago
SUMMARY

I tried to run ansible for fortinet using httpapi. I have configured access_token following the documentation but I got an error message said that access_token was not defined in configuration

Error message seen below

File "/tmp/ansible_fortios_monitor_fact_payload_v68501bf/ansible_fortios_monitor_fact_payload.zip/ansible/module_utils/connection.py", line 199, in rpc ansible.module_utils.connection.ConnectionError: Requested entry (plugin_type: connection plugin: ansible_collections.ansible.netcommon.plugins.connection.httpapi setting: access_token ) was not defined in configuration.

ISSUE TYPE
COMPONENT NAME

fortinet.fortios.fortios and ansible.netcommon httpapi

ANSIBLE VERSION

ansible [core 2.17.1] python version = 3.10.12 (main, Mar 22 2024, 16:50:05) [GCC 11.4.0] (/usr/bin/python3) jinja version = 3.0.3 libyaml = True

COLLECTION VERSION

Collection Version


ansible.netcommon 7.0.0 ansible.utils 5.0.0 community.general 9.1.0 community.network 5.0.3 fortinet.fortios 2.3.6

CONFIGURATION

CONFIG_FILE() = /home/x/.ansible.cfg DEFAULT_STDOUT_CALLBACK(/home/x/.ansible.cfg) = yaml HOST_KEY_CHECKING(/home/x/.ansible.cfg) = False

OS / ENVIRONMENT

Linux ntp 5.15.0-116-generic #126-Ubuntu SMP Mon Jul 1 10:14:24 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

target device Fortinet 7.0.14

STEPS TO REPRODUCE

Use below inventory, groupvars and playbook

Inventory.ini

[firewall:children] fortigate

[fortigate] FGT-1 fortios_access_token=access_token_from_fortigate

group_vars fortigate.yml

ansible_connection: httpapi ansible_network_os: fortinet.fortios.fortios ansible_user: ansible ansible_httpapi_validate_certs: no ansible_httpapi_use_ssl: yes ansible_httpapi_port: 443

playbook backup.yml

EXPECTED RESULTS

Able to backup fortigate through Ansible

ACTUAL RESULTS

Fail with the error message above stating access_token not defined

"/tmp/ansible_fortios_monitor_fact_payload_v68501bf/ansible_fortios_monitor_fact_payload.zip/ansible/module_utils/connection.py", line 199, in rpc ansible.module_utils.connection.ConnectionError: Requested entry (plugin_type: connection plugin: ansible_collections.ansible.netcommon.plugins.connection.httpapi setting: access_token ) was not defined in configuration.