Closed corpslave69 closed 3 weeks ago
Hi @corpslave69 ,
Thank you for bringing this issue to our attention. I am only able to reproduce this error when I provide incorrect user/password credentials. The access token needs to be declared in tasks, but if I provide the wrong credentials, it raises Error: Invalid access token. Please check.
Could you kindly let me know if there are any special characters in your username or password? Additionally, could you please provide the details of your environment, such as the versions of ansible.netcommon and fortinet.fortios, by typing ansible-galaxy collection list
these may be helpful for me to reproduce your problem.
tasks:
- name: fact gathering
fortinet.fortios.fortios_configuration_fact:
access_token: qbb4sdfczQgxmmH7km4c5qnnsw816t2
vdom: root
filters:
- name==port1
- vlanid==0
sorters:
- name,vlanid
- management-ip
formatters:
- name
- management-ip
- vlanid
selector: 'system_interface'
Thanks, Maxx
I am able to get the result when I do a normal REST API call with:
But when I try to do this over an Ansible playbook, I get this:
I am using this playbook: fortigate.yml:
With this inventory:
I have also tried using username and password. Even that produces the same result. Why does it not work only when I'm using Ansible?