Skip to main content
andrewm659
New Member
May 1, 2020
Question

Ansible SSH and ping issues

  • May 1, 2020
  • 3 replies
  • 6291 views

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
}

3 replies

chr00t
New Member
February 2, 2024

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

chr00t
New Member
February 2, 2024

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&context=3

---
- 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 Member
February 2, 2024

Testing my web client, will delete after posting.

chr00t
New Member
February 2, 2024

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

jacks11031984
New Member
February 2, 2024

can you please elaborate the problem you are facing,