<p dir="auto">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:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="FAILED =&gt; failed to resolve remote temporary directory from 
$HOME/.ansible/tmp/ansible-1380135548.99-254800519176889: `mkdir -p 
$HOME/.ansible/tmp/ansible-1380135548.99-254800519176889 &amp;&amp; chmod a+rx 
$HOME/.ansible/tmp/ansible-1380135548.99-254800519176889 &amp;&amp; echo 
$HOME/.ansible/tmp/ansible-1380135548.99-254800519176889` returned empty string"><pre class="notranslate"><code class="notranslate">FAILED =&gt; failed to resolve remote temporary directory from 
$HOME/.ansible/tmp/ansible-1380135548.99-254800519176889: `mkdir -p 
$HOME/.ansible/tmp/ansible-1380135548.99-254800519176889 &amp;&amp; chmod a+rx 
$HOME/.ansible/tmp/ansible-1380135548.99-254800519176889 &amp;&amp; echo 
$HOME/.ansible/tmp/ansible-1380135548.99-254800519176889` returned empty string
</code></pre></div>
<p dir="auto">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.</p>
<p dir="auto">After much head scratching and discovering quite possibly the most usefully arcane Stackoverflow response I've ever seen (<a href="http://stackoverflow.com/a/18472049/484661" rel="nofollow">http://stackoverflow.com/a/18472049/484661</a>), 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:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="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 = &quot;Failed to open session&quot;
187             if len(str(e)) &gt; 0:
188                 msg += &quot;: %s&quot; % str(e)
189             raise errors.AnsibleConnectionFailed(msg)"><pre class="notranslate"><code class="notranslate">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)) &gt; 0:
188                 msg += ": %s" % str(e)
189             raise errors.AnsibleConnectionFailed(msg)
</code></pre></div>
<p dir="auto">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.</p>
<p dir="auto">From <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/jimsmith/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/jimsmith">@jimsmith</a> on 2016-07-09T16:51:59Z</p>

<h5 dir="auto">ISSUE TYPE</h5>

<ul dir="auto">
<li>Bug Report<br>
Originally logged <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="164312838" data-permission-text="Title is private" data-url="https://github.com/ansible/ansible/issues/16622" data-hovercard-type="issue" data-hovercard-url="/ansible/ansible/issues/16622/hovercard" href="https://github.com/ansible/ansible/issues/16622">#16622</a></li>
</ul>
<h5 dir="auto">COMPONENT NAME</h5>
<p dir="auto">rds</p>
<h5 dir="auto">ANSIBLE VERSION</h5>

<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ansible 2.1.0.0"><pre class="notranslate"><code class="notranslate">ansible 2.1.0.0
</code></pre></div>
<h5 dir="auto">CONFIGURATION</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ 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=&quot;False&quot;;
    export ANSIBLE_TRANSPORT=&quot;ssh&quot;;
    export ANSIBLE_SSH_ARGS=&quot;-o ForwardAgent=yes -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null&quot;;
    export ANSIBLE_CONFIG=~/.ansible/ansible.cfg;
    export ANSIBLE_FORCE_COLOR=true;
    $ANSIBLE_HOSTS --refresh-cache &gt; /dev/null;
    export ANSIBLE_HOST_KEY_CHECKING=&quot;False&quot;"><pre class="notranslate"><code class="notranslate">$ 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 &gt; /dev/null;
    export ANSIBLE_HOST_KEY_CHECKING="False"
</code></pre></div>
<h5 dir="auto">OS / ENVIRONMENT</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="CentOS release 6.7 (Final) 64bit"><pre class="notranslate"><code class="notranslate">CentOS release 6.7 (Final) 64bit
</code></pre></div>
<h5 dir="auto">SUMMARY</h5>
<p dir="auto">Modifying RDS multi_zone to no doesn't do anything.</p>
<h5 dir="auto">STEPS TO REPRODUCE</h5>


<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="- name: Change RDS Multi-AZ deployment
  local_action:
        module: rds
        command: modify
        region: &quot;{{ aws_region }}&quot;
        instance_name: &quot;{{ aws_db_instance_name }}&quot;
        multi_zone: &quot;{{ aws_db_multi_zone }}&quot;
        apply_immediately: yes
        wait: yes
        wait_timeout: &quot;{{ aws_db_wait_timeout }}&quot;
  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: &quot;{{ aws_region }}&quot;
    instance_name: &quot;{{ aws_db_instance_name }}&quot;
  register: rds_facts_after
  until : rds_facts_after.instance['status'] == 'available'
  retries: 60
  delay: 60
- debug: var=rds_facts_after

- debug: msg=&quot;vars {{ aws_db_instance_name }} {{ aws_db_multi_zone }} {{ aws_region}} {{ aws_db_wait_timeout }}&quot;
- debug: var=rds_facts_after.instance['status']
"><pre class="notranslate"><code class="notranslate">- 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']

</code></pre></div>

<h5 dir="auto">EXPECTED RESULTS</h5>

<p dir="auto">AWS Console showing the RDS database being modified for No multi-az</p>
<p dir="auto">Gathering rds facts for "multi_zone": false,</p>
<h5 dir="auto">ACTUAL RESULTS</h5>

<p dir="auto">AWS Console show's no modification, cloudtrail show's no API requests.<br>
rds facts module reports "multi_zone": true,</p>

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

</code></pre></div>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="TASK [modify_multi_zone : debug] ***********************************************
task path: /home/jim.smith/modify_multi_zone/tasks/main.yml:34
ok: [localhost] =&gt; {
    &quot;rds_facts_after&quot;: {
        &quot;changed&quot;: false,
        &quot;instance&quot;: {
            &quot;availability_zone&quot;: &quot;eu-west-1a&quot;,
            &quot;backup_retention&quot;: 30,
            &quot;create_time&quot;: 1461930783.596,
            &quot;endpoint&quot;: &quot;RMOVED.eu-west-1.rds.amazonaws.com&quot;,
            &quot;id&quot;: &quot;REMOVED-prod-db1&quot;,
            &quot;instance_type&quot;: &quot;db.t2.small&quot;,
            &quot;iops&quot;: null,
            &quot;maintenance_window&quot;: &quot;mon:00:00-mon:01:15&quot;,
            &quot;multi_zone&quot;: true,
            &quot;port&quot;: 3306,
            &quot;replication_source&quot;: null,
            &quot;status&quot;: &quot;available&quot;,
            &quot;username&quot;: &quot;root&quot;,
            &quot;vpc_security_groups&quot;: &quot;sg-REMOVED&quot;
        }
    }
}"><pre class="notranslate"><code class="notranslate">TASK [modify_multi_zone : debug] ***********************************************
task path: /home/jim.smith/modify_multi_zone/tasks/main.yml:34
ok: [localhost] =&gt; {
    "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"
        }
    }
}
</code></pre></div>
<p dir="auto">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.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="aws rds modify-db-instance --db-instance-identifier REMOVED-prod-db1 \
--no-multi-az \
--apply-immediately"><pre class="notranslate"><code class="notranslate">aws rds modify-db-instance --db-instance-identifier REMOVED-prod-db1 \
--no-multi-az \
--apply-immediately
</code></pre></div>
<p dir="auto">I now had to write a shell wrapper to workaround the rds module not correctly which duplicates the effort and logic needed.</p>
<p dir="auto">Copied from original issue: <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="164675264" data-permission-text="Title is private" data-url="https://github.com/ansible/ansible-modules-core/issues/4145" data-hovercard-type="issue" data-hovercard-url="/ansible/ansible-modules-core/issues/4145/hovercard" href="https://github.com/ansible/ansible-modules-core/issues/4145">ansible/ansible-modules-core#4145</a></p>