Support Forum
The Forums are a place to find answers on a range of Fortinet products from peers and product experts.
andrewm659
New Contributor

Ansible SSH and ping issues

I am trying to use ansible to start making changes to my Fortigate 100D.  I can ssh just fine using my ssh keys.  However I am getting the following error:

 

myhost :( > ansible myfwfgt01.loc.example.net -m ping --user=ansible
[WARNING]: sftp transfer mechanism failed on [myfwfgt01.loc.example.net]. Use ANSIBLE_DEBUG=1 to see detailed information
[WARNING]: scp transfer mechanism failed on [myfwfgt01.loc.example.net]. Use ANSIBLE_DEBUG=1 to see detailed information
myfwfgt01.loc.example.net | FAILED! => {
    "changed": false,
    "module_stderr": "Shared connection to myfwfgt01.loc.example.net closed.\r\n",
    "module_stdout": "myfwfgt01 # Unknown action 0\r\n\r\nmyfwfgt01 # ",
    "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
    "rc": 0
}
myhost :( > ansible myfwfgt01.loc.example.net -m ping
myfwfgt01.loc.example.net | UNREACHABLE! => {
    "changed": false,
    "msg": "Failed to connect to the host via ssh: ameyer@myfwfgt01.loc.example.net: Permission denied (publickey,password).",
    "unreachable": true
}

5 REPLIES 5
chr00t
New Contributor

I know its 4 years after you posted this, but did you ever get this resolved?

chr00t
New Contributor

I was able to get it working by adding this to my playbook:

ansible_network_os: fortinet.fortios.fortios

 

Below is the working playbook. I found the answer from a reddit post reply by aman207, I tested and replied (as a different username in that post): https://www.reddit.com/r/ansible/comments/ysdj5t/comment/kojhxnz/?utm_source=reddit&utm_medium=web2x...

---
- hosts: all
  connection: httpapi
  gather_facts: no
  vars:
     vdom: "root"
     ansible_httpapi_use_ssl: yes
     ansible_httpapi_validate_certs: no
     ansible_httpapi_port: 444
     ansible_network_os: fortinet.fortios.fortios
  tasks:
  - name: Updating Custom Categories
    fortinet.fortios.fortios_webfilter_ftgd_local_rating:
      state: "present"
      webfilter_ftgd_local_rating:
        rating: "140"
        status: "enable"
        url: "support.xerox.com"
Darrell_the_IT-guy
New Contributor

Testing my web client, will delete after posting.

chr00t

I got it working, see my reply to my reply above ;)

jacks11031984
New Contributor

can you please elaborate the problem you are facing, 

Regards
Jack
RegardsJack
Labels
Top Kudoed Authors