Closed Akasurde closed 3 months ago
cc @filterfilter
This is a migrated issue, please ping @filterfilter for more information.
Hi @filterfilter
Sorry for the inconvenience. We do have an issue with Ansible ansible-core==2.17.2. Please upgrade to fortinet.fortios:2.3.7 and give it a try. Let me know if the issue still persists.
ansible-galaxy collection install fortinet.fortios:2.3.7
Thanks, Maxx
Hi @MaxxLiu22
Thank you for your response. I am able to run the playbook using fortinet.fortios:2.3.7 Thanks!
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.
Changing the method from token to username/password also yield the same result
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
Bug Report
Component Name
ansible [core 2.17.2] 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
Ansible Version
Configuration
OS / Environment
Linux ntp 5.15.0-116-generic https://github.com/ansible-collections/ansible.netcommon/issues/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
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
hosts: firewall gather_facts: no collections:
fortinet.fortios tasks:
name: backup a virtual domain. fortios_monitor_fact: vdom: 'root' access_token: "{{ fortios_access_token }}" selector: 'system_config_backup' params: scope: 'global' register: backupinfo
name: Save the backup information. copy: content: '{{ backupinfo.meta.raw }}' dest: 'backups/{{ inventory_hostname }}.config'
Expected Results
Able to backup fortigate through Ansible
Actual Results
Code of Conduct