Hello,

I am trying to use Ansible with Cisco SF300 switches. I use a basic 
playbook that retrieve the version : 



---
- hosts: ios_devices
  gather_facts: no
  connection: local
      


  vars_prompt:
  - name: "mgmt_username"
    prompt: "Username"
    private: no
  - name: "mgmt_password"
    prompt: "Password"


  tasks:
  - name: SYS | Define provider
    set_fact:
      provider:
        host: "{{ inventory_hostname }}" 
        username: "{{ mgmt_username }}"
        password: "{{ mgmt_password }}"


  - name: IOS | Show clock
    ios_command:
      provider: "{{ provider }}"
      commands:
        - show version
    register: version


  - debug: msg="{{ version.stdout }}"

I have the following error : 
fatal: [*hostname*]: FAILED! => {"changed": false, "failed": true, "msg": 
"failed 
to connect to *hostname*"}

I found why : if I had the following configuration *ip ssh password-auth *to 
the switch*, *it is working.

>From the cisco guide : Use the ip ssh password-auth Global Configuration 
mode command to enable password authentication of incoming SSH sessions.


The thing is normally when I connect to a switch by ssh, I am still asked 
for a user name and password after being connected before entering 
commands. 

I tried the option *authorize *of the ios_command module but it's not 
working.

I could manually add this configuration of the ssh server on every switch 
but it is a long job to do. 

Do you have any other solutions ?

Have a nice day !

Romain



-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/37e154b7-6bde-450d-aaf1-67fbfa4a6248%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to