fortinet-ansible-dev / ansible-galaxy-fortimanager-collection

GNU General Public License v3.0
16 stars 16 forks source link

How to use network_cli+ssh to send commands to the console, without api? #43

Open gaetanquentin opened 2 years ago

gaetanquentin commented 2 years ago

We want to use the network_cli connector with ssh to launch commands to the console directly, without using httpapi.

Is this possible?

My first tests seems to demonstrate that it is not possible:

Exemples:


tasks:
- name: run show version on remote devices
  ansible.netcommon.cli_command:
    command:  diagnose hardware info

with inventory vars:
ansible_network_os: fortinet.fortimanager
ansible_connection: ansible.netcommon.network_cli
results:
fatal: [MYDEVICE]: FAILED! => {
    "msg": "network os fortinet.fortimanager.fortimanager is not supported"
}

with inventory vars:

ansible_network_os: fortinet.fortimanager
ansible_connection: httpapi

results:

fatal: [MYDEVICE]: FAILED! => {
    "changed": false,
    "msg": "Connection type httpapi is not valid for this module"
}

So is there a solution?