trouble using sros modules to log in with a specific user

133 views
Skip to first unread message

Nick Keeling

unread,
Dec 1, 2016, 11:16:06 AM12/1/16
to Ansible Project
First of all, I am still learning Ansible, so there is a very real possibility this is user error, but here is my issue:

When I try to log in using the sros module, regardless of the username I am using in the yml file, it is using my username from the ansible host machine

Here is the yml:

---
- name: Test SROS in lab
  hosts
: lab-12e
  vars
:
    cli
:
      host
: "{{ inventory_hostname }}"
      username
: ansible
      ssh_keyfile
: /home/nkeeling/ansible/rsa-keys/ansible_rsa.pub
      transport
: cli
  tasks
:
   
- name: run show version on remote devices
      sros_command
:
        commands
: show version
        provider
: "{{ cli }}"

This was taken directly from the examples for the module. When I run the module, I get a failure:

nkeeling@eng-tools:~/ansible$ ansible-playbook sros_test.yml


PLAY
[Test SROS in lab] ********************************************************


TASK
[setup] *******************************************************************
fatal
: [192.168.253.137]: UNREACHABLE! => {"changed": false, "msg": "Failed to connect to the host via ssh: TiMOS-C-13.0.R4 cpm/hops64 ALCATEL SR 7750 Copyright (c) 2000-2015 Alcatel-Lucent.\r\nAll rights reserved. All use subject to applicable license agreements.\r\nBuilt on Wed Jul 29 16:27:26 PDT 2015 by builder in /rel13.0/b1/R4/panos/main\r\nThis computer system is the property of xxxxxxxxx Networks. It is for authorized use only. Users (authorized or unauthorized) have no explicit or implicit expectation of privacy. Unauthorized or improper use of this system may result in administrative disciplinary action and civil and criminal penalties. \r\nPermission denied (publickey,password).\r\n", "unreachable": true}
        to
retry, use: --limit @/home/nkeeling/ansible/sros_test.retry


PLAY RECAP
*********************************************************************
192.168.253.137            : ok=0    changed=0    unreachable=1    failed=0  

When I look at the security log on my SR-OS device, I see:

64 2001/02/23 22:41:40.17 PST MINOR: SECURITY #2011 Base nkeeling
"User nkeeling from 172.17.25.236 failed authentication"

I have tried setting the username in multiple places in the yml file, with no change in the result. If anyone is able to steer me in the right direction, it would be VERY much appreciated!


Peter Sprygada

unread,
Dec 12, 2016, 9:32:20 PM12/12/16
to ansible...@googlegroups.com
Hi Nick,

Not sure if you figure this out yet or not but you need to add connection: local to your playbook. Your updated playbook should look like this: 


Peter

--
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 ansible-project+unsubscribe@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/7a2fb8ea-c77c-4b8d-a2aa-7caed9ced2ae%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages