ec2.py and the incredibly no good bad corporate overlords policies.

Hey All,

Our corporate overlords have deemed it prudent to not allow IP addresses to go out through our proxy. So we cannot ssh to an IP address and have to use the FQDN. The ec2.py script does not return the DNS record of the public IP of the server. It is always returning the public IP address even though I have set the following in ec2.ini:

destination_variable = public_dns_name

vpc_destination_variable = public_dns_name

Anybody know why?

Below is the full ec2.ini file.

Thanks,

Joe

Ansible EC2 external inventory script settings

Check «DNS Hostnames=Yes» in your VPC settings (not in Ansible).

Ok that fixed that issue! Thank you very much. However for some reason the first time I run ( or run again after a short period of time) the ping module against all hosts it fails on the first 2 hosts always fails with the same error. If i run it a second time right after it works just fine. Here is the error:

“msg”: “failed to transfer file to /home/ec2-user/.ansible/tmp/ansible-tmp-1467127255.64-133176804889810/ping:\nsftp> put /tmp/tmpCl5Pww /home/ec2-user/.ansible/tmp/ansible-tmp-1467127255.64-133176804889810/ping\n\nOpenSSH_7.2p2 Ubuntu-4ubuntu1, OpenSSL 1.0.2g-fips 1 Mar 2016\r\ndebug1: Reading configuration data /home//.ssh/config\r\ndebug1: /home//.ssh/config line 1: Applying options for *\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 19: Applying options for *\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: done pid = 6845\r\ndebug3: mux_client_request_session: session request sent\r\ndebug1: mux_client_request_session: master session id: 4\r\ndebug2: Remote version: 3\r\ndebug2: Server supports extension "posix-rename@openssh.com" revision 1\r\ndebug2: Server supports extension "statvfs@openssh.com" revision 2\r\ndebug2: Server supports extension "fstatvfs@openssh.com" revision 2\r\ndebug2: Server supports extension "hardlink@openssh.com" revision 1\r\ndebug2: Server supports extension "fsync@openssh.com" revision 1\r\ndebug3: Sent message fd 5 T:16 I:1\r\ndebug3: SSH_FXP_REALPATH . → /home/ec2-user size 0\r\ndebug3: Looking up /tmp/tmpCl5Pww\r\ndebug3: Sent message fd 5 T:17 I:2\r\ndebug3: Received stat reply T:101 I:2\r\ndebug1: Couldn’t stat remote file: No such file or directory\r\ndebug3: Sent message SSH2_FXP_OPEN I:3 P:/home/ec2-user/.ansible/tmp/ansible-tmp-1467127255.64-133176804889810/ping\r\nremote open("/home/ec2-user/.ansible/tmp/ansible-tmp-1467127255.64-133176804889810/ping"): No such file or directory\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 0\r\n”