using ansible when sftp is not available

388 views
Skip to first unread message

Craig Wilson

unread,
Apr 7, 2016, 12:44:38 PM4/7/16
to Ansible Project
Hi all

We are looking into ansible and one of the things we would like to do is issue a few commands to some storage appliances that we have. They are looked down and as such we can not access sftp or even scp just ssh into their custom command line interface.

I'm testing this and I've managed to get raw module working to retrieve information, as below:

---
- hosts: Storage1
  remote_user: user
  gather_facts: no  
  tasks:
  - name: showcon
    raw: show controller


However when I use the expect module it still tries to use sftp, 
---
- hosts: Storage1
  remote_user: user
  gather_facts: no
  tasks:
    - name: "ControllerRestart"
      expect:
        command: "shutdown controller restart"
        responses:
          (?i)REMOTE: "yes"


and if I execute this I get
Storage1 | UNREACHABLE! => {
    "changed": false, 
    "msg": "SSH Error: data could not be sent to the remote host. Make sure this host can be reached over ssh", 
    "unreachable": true
}




Is there any way to use the expect (or other modules) without ansible running sftp/scp commands?

David Williams

unread,
Feb 27, 2017, 6:27:39 PM2/27/17
to Ansible Project
Did you ever find a solution to this?  I'm having the same issue.  Does the expect module really generate a python file, send it to the remote host, and execute it there to pull this off?  Can't it just execute like an expect script locally?

Kai Stian Olstad

unread,
Feb 28, 2017, 2:46:34 AM2/28/17
to ansible...@googlegroups.com
On 28.02.2017 00:14, David Williams wrote:
> I'm having the same issue. Does the
> expect module really generate a python file, send it to the remote
> host,
> and execute it there to pull this off?

Yes, it does if you don't tell it not to do it.


> Can't it just execute like an expect script locally?

Yes, just use "delegate_to: localhost" on the task and expect will run
on the Ansible controller host.


--
Kai Stian Olstad
Reply all
Reply to author
Forward
0 new messages