Issue 1:
I have been using Ansible on 12 hosts with no issues at all. For some reason, when I tried to add the 13th host (lucky, lucky), the tool threw an error I hadn't seen before:

FAILED => failed to resolve remote temporary directory from
$HOME/.ansible/tmp/ansible-1380135548.99-254800519176889: `mkdir -p
$HOME/.ansible/tmp/ansible-1380135548.99-254800519176889 && chmod a+rx
$HOME/.ansible/tmp/ansible-1380135548.99-254800519176889 && echo
$HOME/.ansible/tmp/ansible-1380135548.99-254800519176889` returned empty string

Google failed me utterly, so I did some digging through the source. I found that the ansible/runner/connection_plugins/paramiko_ssh.py script simply wasn't returning any response from the this host. The public key was set up just like the other 12, and I was able to SSH in without a password, but Paramiko just wouldn't return any data.

After much head scratching and discovering quite possibly the most usefully arcane Stackoverflow response I've ever seen (http://stackoverflow.com/a/18472049/484661), I found that that the only way to get this particular host to return anything was by calling the get_pty() function on the Paramiko channel that exec_command opens:

178 def exec_command(self, cmd, tmp_path, sudo_user, sudoable=False, executable='/bin/sh'):
179 ''' run a command on the remote host '''
180
181 bufsize = 4096
182 try:
183 chan = self.ssh.get_transport().open_session()
184 chan.get_pty()
185 except Exception, e:
186 msg = "Failed to open session"
187 if len(str(e)) > 0:
188 msg += ": %s" % str(e)
189 raise errors.AnsibleConnectionFailed(msg)

Adding this made Ansible work with this host, and it did not cause any issue with the previous 12. I realize this is more of a Paramiko issue than an Ansible one, but I figured this should be reported as an Ansible bug for now since you can work around it with the get_pty() function.

Issue 2:
From @jimsmith on 2016-07-09T16:51:59Z

ISSUE TYPE

Bug Report

Originally logged #16622

COMPONENT NAME

rds

ANSIBLE VERSION

ansible 2.1.0.0

CONFIGURATION

$ set | grep ANSIBLE
ANSIBLE_CONFIG=/home/jim.smith/.ansible/ansible.cfg
ANSIBLE_FORCE_COLOR=true
ANSIBLE_HOSTS=/home/jim.smith/.ansible/aws/ec2.py
ANSIBLE_HOST_KEY_CHECKING=False
ANSIBLE_SSH_ARGS='-o ForwardAgent=yes -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null'
ANSIBLE_TRANSPORT=ssh
export ANSIBLE_HOSTS=~/.ansible/aws/ec2.py;
export ANSIBLE_HOST_KEY_CHECKING="False";
export ANSIBLE_TRANSPORT="ssh";
export ANSIBLE_SSH_ARGS="-o ForwardAgent=yes -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null";
export ANSIBLE_CONFIG=~/.ansible/ansible.cfg;
export ANSIBLE_FORCE_COLOR=true;
$ANSIBLE_HOSTS --refresh-cache > /dev/null;
export ANSIBLE_HOST_KEY_CHECKING="False"

OS / ENVIRONMENT

CentOS release 6.7 (Final) 64bit

SUMMARY

Modifying RDS multi_zone to no doesn't do anything.

STEPS TO REPRODUCE

- name: Change RDS Multi-AZ deployment
local_action:
module: rds
command: modify
region: "{{ aws_region }}"
instance_name: "{{ aws_db_instance_name }}"
multi_zone: "{{ aws_db_multi_zone }}"
apply_immediately: yes
wait: yes
wait_timeout: "{{ aws_db_wait_timeout }}"
register: modify_rds_multi_az
- debug: var=modify_rds_multi_az

- name: Wait for a minute for the API call to get actioned so the instance is available but modifying
pause: minutes=1

- name: Poll RDS change
local_action:
module : rds
command: facts
region: "{{ aws_region }}"
instance_name: "{{ aws_db_instance_name }}"
register: rds_facts_after
until : rds_facts_after.instance['status'] == 'available'
retries: 60
delay: 60
- debug: var=rds_facts_after

- debug: msg="vars {{ aws_db_instance_name }} {{ aws_db_multi_zone }} {{ aws_region}} {{ aws_db_wait_timeout }}"
- debug: var=rds_facts_after.instance['status']

EXPECTED RESULTS

AWS Console showing the RDS database being modified for No multi-az

Gathering rds facts for "multi_zone": false,

ACTUAL RESULTS

AWS Console show's no modification, cloudtrail show's no API requests.

rds facts module reports "multi_zone": true,

TASK [modify_multi_zone : Change RDS Multi-AZ deployment] **********************
task path: /home/jim.smith/modify_multi_zone/tasks/main.yml:8
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: jim.smith
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1467897722.6-238584385008593 `" && echo ansible-tmp-1467897722.6-238584385008593="` echo $HOME/.ansible/tmp/ansible-tmp-1467897722.6-238584385008593 `" ) && sleep 0'
<localhost> PUT /tmp/tmpRagNjF TO /home/jim.smith/.ansible/tmp/ansible-tmp-1467897722.6-238584385008593/rds
<localhost> EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /home/jim.smith/.ansible/tmp/ansible-tmp-1467897722.6-238584385008593/rds; rm -rf "/home/jim.smith/.ansible/tmp/ansible-tmp-1467897722.6-238584385008593/" > /dev/null 2>&1 && sleep 0'
changed: [localhost -> localhost] => {"changed": true, "instance": {"availability_zone": "eu-west-1a", "backup_retention": 30, "create_time": 1461930783.596, "endpoint": "REMOVED.eu-west-1.rds.amazonaws.com", "id": "REMOVED-prod-db1", "instance_type": "db.t2.small", "iops": null, "maintenance_window": "mon:00:00-mon:01:15", "multi_zone": true, "port": 3306, "replication_source": null, "status": "available", "username": "root", "vpc_security_groups": "sg-REMOVED"}, "invocation": {"module_args": {"apply_immediately": true, "aws_access_key": null, "aws_secret_key": null, "backup_retention": null, "backup_window": null, "character_set_name": null, "command": "modify", "db_engine": null, "db_name": null, "ec2_url": null, "engine_version": null, "force_failover": false, "instance_name": "REMOVED-prod-db1", "instance_type": null, "iops": null, "license_model": null, "maint_window": null, "multi_zone": false, "new_instance_name": null, "option_group": null, "parameter_group": null, "password": null, "port": null, "profile": null, "publicly_accessible": null, "region": "eu-west-1", "security_groups": null, "security_token": null, "size": null, "snapshot": null, "source_instance": null, "subnet": null, "tags": null, "upgrade": false, "username": null, "validate_certs": true, "vpc_security_groups": null, "wait": true, "wait_timeout": 2400, "zone": null}, "module_name": "rds"}}

TASK [modify_multi_zone : debug] ***********************************************
task path: /home/jim.smith/modify_multi_zone/tasks/main.yml:34
ok: [localhost] => {
"rds_facts_after": {
"changed": false,
"instance": {
"availability_zone": "eu-west-1a",
"backup_retention": 30,
"create_time": 1461930783.596,
"endpoint": "RMOVED.eu-west-1.rds.amazonaws.com",
"id": "REMOVED-prod-db1",
"instance_type": "db.t2.small",
"iops": null,
"maintenance_window": "mon:00:00-mon:01:15",
"multi_zone": true,
"port": 3306,
"replication_source": null,
"status": "available",
"username": "root",
"vpc_security_groups": "sg-REMOVED"
}
}
}

I should have mentioned that using the following (right after the playbook completes) AWS CLI command works and I can see RDS being modified and RDS Events showing the request being actioned.

aws rds modify-db-instance --db-instance-identifier REMOVED-prod-db1 \
--no-multi-az \
--apply-immediately

I now had to write a shell wrapper to workaround the rds module not correctly which duplicates the effort and logic needed.

Copied from original issue: ansible/ansible-modules-core#4145