Skip to content

Instantly share code, notes, and snippets.

@hortonew
Created April 25, 2017 17:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hortonew/cd54a30d597d0297a4130f5e9a798267 to your computer and use it in GitHub Desktop.
Save hortonew/cd54a30d597d0297a4130f5e9a798267 to your computer and use it in GitHub Desktop.
Proxy Config for Ansible
Variables
AnsibleServer = current servername
RemoteServerIP = server i'm trying to ping
MyUsername = username with same password across local, proxy, and remote server
MyProxyHostIP = proxy host IP
[ansible@AnsibleServer ~]$ ansible -m ping -i teams/monitoring/ RemoteServerIP -u MyUsername -k -vvvv
Using /home/ansible/ansible.cfg as config file
SSH password:
Loading callback plugin minimal of type stdout, v2.0 from /usr/lib/python2.7/site-packages/ansible/plugins/callback/__init__.pyc
Using module file /usr/lib/python2.7/site-packages/ansible/modules/core/system/ping.py
<RemoteServerIP> ESTABLISH SSH CONNECTION FOR USER: MyUsername
<RemoteServerIP> SSH: EXEC sshpass -d12 ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o User=MyUsername -o ConnectTimeout=10 -o 'ProxyCommand=ssh -W %h:%p -q MyUsername@MyProxyHostIP' -o ControlPath=/home/ansible/.ansible/cp/ansible-ssh-%h-%p-%r RemoteServerIP '/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo ~/.ansible/tmp/ansible-tmp-1493141470.31-109633446072774 `" && echo ansible-tmp-1493141470.31-109633446072774="` echo ~/.ansible/tmp/ansible-tmp-1493141470.31-109633446072774 `" ) && sleep 0'"'"''
RemoteServerIP | UNREACHABLE! => {
"changed": false,
"msg": "Authentication failure.",
"unreachable": true
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment