Hi,

I am writing a module to a storage nas that allows me to connect to it 
using ssh. However, it does not provide a standard shell. So I cannot 
connect to it using command and shell modules. It works with raw  assuming 
I set gather facts = to no.

The reason is that Ansible seems to always do the initial connection with 
'/bin/sh -c '"'"'echo ~ && sleep 0'"'"'' to check if it can connect and 
fails if that command fails. As there is no home directory or /bin/sh the 
connection fails.
Here is the error:
<192.168.xx.xx> SSH: EXEC ssh -C -o ControlMaster=auto -o 
ControlPersist=60s -o KbdInteractiveAuthentication=no -o 
PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey 
-o PasswordAuthentication=no -o ConnectTimeout=10 -o 
ControlPath=/home/somename/.ansible/cp/xxxx 192.168.xx.xxx *'/bin/sh -c 
'"'"'echo ~ && sleep 0'"'"'*'
<192.168.xx.xx> (255, '', 'Permission denied 
(publickey,gssapi-keyex,gssapi-with-mic,password,keyboard-interactive).\r\n')
fatal: [somenas]: UNREACHABLE! => {
    "changed": false,
    "msg": "Failed to connect to the host via ssh: Permission denied 
(publickey,gssapi-keyex,gssapi-with-mic,password,keyboard-interactive).\r\n",
    "unreachable": true
}

Using raw avoids the checks and is a solution. However, I would Like to 
write a module to manage the storage in a better way. However, it seems 
like the connection is always happening using the above connection. I have 
tried both by using the standard way of using AnsibleModule and to write my 
own connection using paramiko SSHClient. But even when just calling this 
simple module Ansible is still first trying to do the ssh connection first 
before the connection from my module is invoked. 

So my question is can I avoid the initial connection or change the specific 
check *'/bin/sh -c '"'"'echo ~ && sleep 0'"'"'*' to something that works on 
this storage?

Thanks,
Mikael

-- 
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/ff104712-c708-45d4-bbb1-d713e94ce220%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to