Not able to ssh on fortigate from ansible

123 views
Skip to first unread message

Bharat Bhushan Mehta

unread,
Feb 10, 2020, 5:40:03 AM2/10/20
to Ansible Project
Hi Team,

I am trying to take config backup of fortigate vm which is having version v6.2.3 using ansible, while doing this i am getting below error:-
The full traceback is:
WARNING: The below traceback may *not* be related to the actual failure.
  File "/tmp/ansible_fortios_config_payload_BI_dEM/ansible_fortios_config_payload.zip/ansible/modules/network/fortios/fortios_config.py", line 126, in main
  File "/usr/lib/python2.7/site-packages/pyFG/fortios.py", line 103, in open
    self.ssh.connect(**cfg)
  File "/usr/lib/python2.7/site-packages/paramiko/client.py", line 380, in connect
    look_for_keys, gss_auth, gss_kex, gss_deleg_creds, gss_host)
  File "/usr/lib/python2.7/site-packages/paramiko/client.py", line 554, in _auth
    self._agent = Agent()
  File "/usr/lib/python2.7/site-packages/paramiko/agent.py", line 363, in __init__
    self._connect(conn)
  File "/usr/lib/python2.7/site-packages/paramiko/agent.py", line 68, in _connect
    raise SSHException('could not get keys from ssh-agent')

fatal: [localhost]: FAILED! => {
    "changed": false,
    "invocation": {
        "module_args": {
            "backup": true,
            "backup_filename": null,
            "backup_path": "/tmp",
            "config_file": null,
            "file_mode": false,
            "filter": "",
            "host": "10.35.110.133",
            "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "src": null,
            "timeout": 60,
            "username": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "vdom": "root"
        }
    },
    "msg": "Error connecting device"

Here is my play book

- hosts: "localhost"
  connection: local
  gather_facts: False
  vars:
   host: "10.35.110.133"
   vdom: "root"
   ssl_verify: "False"
  tasks:
   - name: Backup current config
     fortios_config:
      host: "10.35.110.133"
      username: admin
      password: admin
      backup: yes
      backup_path: /tmp

Please suggest what i can do over here
Reply all
Reply to author
Forward
0 new messages