All,
I need to launch a program on a remote node that has a gui and display that gui on the local node from which I ran ansible.
I can do this manually just fine. Run the following and xclock from the remote node appears on the local node. Good!!
$ ssh -X -v remote $ xclock
Here’s what I’m doing in ansible:
playbook
`
I can do this manually just fine. Run the following and xclock from
the remote node appears on the local node. Good!!
$ ssh -X -v remote
$ xclock
Here's what I'm doing in ansible:
playbook
---
- hosts: remote
tasks:
- name: Start xcalc
shell: "xcalc"
You ran 'xclock' manually, but your playbook says 'xcalc'. Does it work if
your playbook says 'xclock'?
ERROR: ...command not found...
That could also be a path thing; maybe xcalc isn't in your path when
Ansible logs in. Try /usr/X11/bin/xclock, or whatever the full path to it is?
-Josh (jbs@care.com)
(apologies for the automatic corporate disclaimer that follows)
This email is intended for the person(s) to whom it is addressed and may contain information that is PRIVILEGED or CONFIDENTIAL. Any unauthorized use, distribution, copying, or disclosure by any person other than the addressee(s) is strictly prohibited. If you have received this email in error, please notify the sender immediately by return email and delete the message and any attachments from your system.
Good catch Josh, but the issue remains. My remote node has both xclock and xcalc installed. It’s standard gnome stuff. Maybe I am reading the error message wrong:
NOTE: hla2 is my remote node. The “command not found” entry is 4th line up from the bottom. It says UREACHABLE, then it connects anyway. Go figure.
fatal: [hla2]: UNREACHABLE! => {"changed": false, "msg": "Failed to connect to the host via ssh: OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 19: Applying options for *\r\nPseudo-terminal will not be allocated because stdin is not a terminal.\r\ndebug1: Connecting to hla2 [192.168.50.102] port 22.\r\ndebug1: Connection established.\r\ndebug1: identity file /home/vagrant/.ssh/id_rsa type 1\r\ndebug1: identity file /home/vagrant/.ssh/id_rsa-cert type -1\r\ndebug1: identity file /home/vagrant/.ssh/id_dsa type -1\r\ndebug1: identity file /home/vagrant/.ssh/id_dsa-cert type -1\r\ndebug1: identity file /home/vagrant/.ssh/id_ecdsa type -1\r\ndebug1: identity file /home/vagrant/.ssh/id_ecdsa-cert type -1\r\ndebug1: identity file /home/vagrant/.ssh/id_ed25519 type -1\r\ndebug1: identity file /home/vagrant/.ssh/id_ed25519-cert type -1\r\ndebug1: Enabling compatibility mode for protocol 2.0\r\ndebug1: Local version string SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.8\r\ndebug1: Remote protocol version 2.0, remote software version OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.8\r\ndebug1: match: OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.8 pat OpenSSH_6.6.1* compat 0x04000000\r\ndebug1: SSH2_MSG_KEXINIT sent\r\ndebug1: SSH2_MSG_KEXINIT received\r\ndebug1: kex: server->client aes128-ctr hmac-md5-etm@openssh.com none\r\ndebug1: kex: client->server aes128-ctr hmac-md5-etm@openssh.com none\r\ndebug1: sending SSH2_MSG_KEX_ECDH_INIT\r\ndebug1: expecting SSH2_MSG_KEX_ECDH_REPLY\r\ndebug1: Server host key: ECDSA 57:6f:c3:a9:ab:2f:8a:ae:62:76:71:0e:78:cc:ca:37\r\ndebug1: Host 'hla2' is known and matches the ECDSA host key.\r\ndebug1: Found key in /home/vagrant/.ssh/known_hosts:4\r\ndebug1: ssh_ecdsa_verify: signature correct\r\ndebug1: SSH2_MSG_NEWKEYS sent\r\ndebug1: expecting SSH2_MSG_NEWKEYS\r\ndebug1: SSH2_MSG_NEWKEYS received\r\ndebug1: SSH2_MSG_SERVICE_REQUEST sent\r\ndebug1: SSH2_MSG_SERVICE_ACCEPT received\r\ndebug1: Authentications that can continue: publickey,password\r\ndebug1: Next authentication method: publickey\r\ndebug1: Offering RSA public key: /home/vagrant/.ssh/id_rsa\r\ndebug1: Server accepts key: pkalg ssh-rsa blen 279\r\ndebug1: Authentication succeeded (publickey).\r\nAuthenticated to hla2 ([192.168.50.102]:22).\r\ndebug1: channel 0: new [client-session]\r\ndebug1: Requesting no-more-sessions@openssh.com\r\ndebug1: Entering interactive session.\r\ndebug1: Requesting X11 forwarding with authentication spoofing.\r\ndebug1: Sending environment.\r\ndebug1: Sending env LANG = en_US.UTF-8\r\n-bash: line 1: SSH-2.0-OpenSSH_6.6.1p1: command not found\nConnection timed out during banner exchange\r\ndebug1: channel 0: free: client-session, nchannels 1\r\ndebug1: fd 0 clearing O_NONBLOCK\r\ndebug1: fd 1 clearing O_NONBLOCK\r\ndebug1: fd 2 clearing O_NONBLOCK\r\ndebug1: Killed by signal 1.\r\n", "unreachable": true}
SOLVED!!!
I made the following change and it worked.
[fedmanager] hla2 ansible_ssh_extra_args='-v -X'
The whole business of -o ProxyCommand etc… was leading me astray. Do the above and remote X is a breeze.