<h5 dir="auto">Issue Type:</h5>
<p dir="auto">Bug Report, Documentation Report</p>
<h5 dir="auto">Ansible Version:</h5>
<p dir="auto">1.7.1</p>
<h5 dir="auto">Environment:</h5>
<p dir="auto">N/A</p>
<h5 dir="auto">Summary:</h5>
<p dir="auto">There appears to be a regression in the ability to set and override default arguments to modules requiring complex arguments.</p>
<p dir="auto">According to <a href="https://github.com/ansible/ansible-examples/blob/master/language_features/complex_args.yml">https://github.com/ansible/ansible-examples/blob/master/language_features/complex_args.yml</a>, we should be able to pass default parameters to modules. In fact, it shows an example of overriding the default fact locally, which no longer works either. Even in 1.7.0, adding an override (e.g. "ec2: region=us-west-1") results in the following error:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content=" msg: duplicate parameter: region (value=us-west-1)"><pre class="notranslate"><code class="notranslate"> msg: duplicate parameter: region (value=us-west-1)
</code></pre></div>
<h5 dir="auto">Steps To Reproduce:</h5>
<p dir="auto">The following works in 1.7.0, but not in 1.7.1, as shown by the output below:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="# in file: test.yml
- hosts: localhost
  connection: local
  gather_facts: False
  vars:
    default:
      region: us-east-1
      instance_type: m3.medium
      image: ami-d2ff23ba
  tasks:
    - name: Provision hosts
      ec2:
      args: default"><pre class="notranslate"><code class="notranslate"># in file: test.yml
- hosts: localhost
  connection: local
  gather_facts: False
  vars:
    default:
      region: us-east-1
      instance_type: m3.medium
      image: ami-d2ff23ba
  tasks:
    - name: Provision hosts
      ec2:
      args: default
</code></pre></div>
<h5 dir="auto">Expected Results:</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ sudo pip install ansible==1.7.0
$ ansible-playbook test.yml

PLAY [localhost] **************************************************************

TASK: [Provision hosts] *******************************************************
changed: [127.0.0.1]

PLAY RECAP ********************************************************************
127.0.0.1                  : ok=1    changed=1    unreachable=0    failed=0"><pre class="notranslate"><code class="notranslate">$ sudo pip install ansible==1.7.0
$ ansible-playbook test.yml

PLAY [localhost] **************************************************************

TASK: [Provision hosts] *******************************************************
changed: [127.0.0.1]

PLAY RECAP ********************************************************************
127.0.0.1                  : ok=1    changed=1    unreachable=0    failed=0
</code></pre></div>
<h5 dir="auto">Actual Results:</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ sudo pip install ansible==1.7.1
[...]
$ ap test.yml 

PLAY [localhost] ************************************************************** 

TASK: [Provision hosts] ******************************************************* 
ERROR: args must be a dictionary, received default (&lt;type 'str'&gt;"><pre class="notranslate"><code class="notranslate">$ sudo pip install ansible==1.7.1
[...]
$ ap test.yml 

PLAY [localhost] ************************************************************** 

TASK: [Provision hosts] ******************************************************* 
ERROR: args must be a dictionary, received default (&lt;type 'str'&gt;
</code></pre></div>
<p dir="auto">Possibly related to <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="28609905" data-permission-text="Title is private" data-url="https://github.com/ansible/ansible/issues/6244" data-hovercard-type="issue" data-hovercard-url="/ansible/ansible/issues/6244/hovercard" href="https://github.com/ansible/ansible/issues/6244">#6244</a>; see <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="28609905" data-permission-text="Title is private" data-url="https://github.com/ansible/ansible/issues/6244" data-hovercard-type="issue" data-hovercard-url="/ansible/ansible/issues/6244/hovercard?comment_id=53008716&amp;comment_type=issue_comment" href="https://github.com/ansible/ansible/issues/6244#issuecomment-53008716">#6244 (comment)</a></p>
<h5 dir="auto">ISSUE TYPE</h5>
<p dir="auto">bug report</p>
<h5 dir="auto">COMPONENT NAME</h5>
<p dir="auto">copy module</p>
<h5 dir="auto">ANSIBLE VERSION</h5>
<p dir="auto">2.0.0.2</p>
<h5 dir="auto">CONFIGURATION</h5>
<p dir="auto">forks          = 15<br>
roles_path    = ./roles<br>
host_key_checking = False</p>
<h5 dir="auto">OS / ENVIRONMENT</h5>
<p dir="auto">Mac OS X 10.11.1 (15B42)<br>
Python 2.7.10</p>
<h5 dir="auto">SUMMARY</h5>
<p dir="auto">While trying to copy directories remotely on target machine from <strong>src=/srv/repo/ops/server/conf/</strong> to <strong>dst=/srv/server/conf/</strong> (both exist on remote machine) , using copy module with "remote_src=yes" flag, end up with error:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="failed: [x.x.x.x] =&gt; (item={u'dstfile': u'/srv/server/conf/', u'srcfile': u'/srv/repo/ops/server/conf/'}) =&gt; {&quot;failed&quot;: true, &quot;invocation&quot;: {&quot;module_args&quot;: {&quot;backup&quot;: false, &quot;content&quot;: null, &quot;delimiter&quot;: null, &quot;dest&quot;: &quot;/srv/server/conf/&quot;, &quot;directory_mode&quot;: null, &quot;follow&quot;: false, &quot;force&quot;: true, &quot;group&quot;: null, &quot;mode&quot;: null, &quot;original_basename&quot;: null, &quot;owner&quot;: null, &quot;regexp&quot;: null, &quot;remote_src&quot;: true, &quot;selevel&quot;: null, &quot;serole&quot;: null, &quot;setype&quot;: null, &quot;seuser&quot;: null, &quot;src&quot;: &quot;/srv/repo/ops/server/conf/&quot;, &quot;validate&quot;: null}}, &quot;item&quot;: {&quot;dstfile&quot;: &quot;/srv/server/conf/&quot;, &quot;srcfile&quot;: &quot;/srv/repo/ops/server/conf/&quot;}, &quot;msg&quot;: &quot;attempted to take checksum of directory: /srv/repo/ops/server/conf/&quot;}"><pre class="notranslate"><code class="notranslate">failed: [x.x.x.x] =&gt; (item={u'dstfile': u'/srv/server/conf/', u'srcfile': u'/srv/repo/ops/server/conf/'}) =&gt; {"failed": true, "invocation": {"module_args": {"backup": false, "content": null, "delimiter": null, "dest": "/srv/server/conf/", "directory_mode": null, "follow": false, "force": true, "group": null, "mode": null, "original_basename": null, "owner": null, "regexp": null, "remote_src": true, "selevel": null, "serole": null, "setype": null, "seuser": null, "src": "/srv/repo/ops/server/conf/", "validate": null}}, "item": {"dstfile": "/srv/server/conf/", "srcfile": "/srv/repo/ops/server/conf/"}, "msg": "attempted to take checksum of directory: /srv/repo/ops/server/conf/"}
</code></pre></div>
<h5 dir="auto">STEPS TO REPRODUCE</h5>
<p dir="auto">Create directories on remote machine using ansible file module :</p>
<ul dir="auto">
<li>src dir : /srv/repo/ops/server/conf/  <em>// put some test files here</em></li>
<li>dst dir: /srv/server/conf/</li>
</ul>
<p dir="auto">Try to copy content from src to dst using copy module with <em>remote_src=1</em>, example:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="- name: Copy config files for services
  copy: src={{ item.srcfile }} dest={{ item.dstfile }} remote_src=yes
  with_items:
   - { srcfile: &quot;/srv/repo/ops/server/conf/&quot;, dstfile: &quot;/srv/server/conf/&quot; }"><pre class="notranslate"><code class="notranslate">- name: Copy config files for services
  copy: src={{ item.srcfile }} dest={{ item.dstfile }} remote_src=yes
  with_items:
   - { srcfile: "/srv/repo/ops/server/conf/", dstfile: "/srv/server/conf/" }
</code></pre></div>
<h5 dir="auto">EXPECTED RESULTS</h5>
<p dir="auto">Content from <strong>/srv/repo/ops/server/conf/</strong> should be propagated to <strong>/srv/server/conf/</strong></p>
<h5 dir="auto">ACTUAL RESULTS</h5>
<p dir="auto">failed with below error:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="failed: [x.x.x.x] =&gt; (item={u'dstfile': u'/srv/server/conf/', u'srcfile': u'/srv/repo/ops/server/conf/'}) =&gt; {&quot;failed&quot;: true, &quot;invocation&quot;: {&quot;module_args&quot;: {&quot;backup&quot;: false, &quot;content&quot;: null, &quot;delimiter&quot;: null, &quot;dest&quot;: &quot;/srv/server/conf/&quot;, &quot;directory_mode&quot;: null, &quot;follow&quot;: false, &quot;force&quot;: true, &quot;group&quot;: null, &quot;mode&quot;: null, &quot;original_basename&quot;: null, &quot;owner&quot;: null, &quot;regexp&quot;: null, &quot;remote_src&quot;: true, &quot;selevel&quot;: null, &quot;serole&quot;: null, &quot;setype&quot;: null, &quot;seuser&quot;: null, &quot;src&quot;: &quot;/srv/repo/ops/server/conf/&quot;, &quot;validate&quot;: null}}, &quot;item&quot;: {&quot;dstfile&quot;: &quot;/srv/server/conf/&quot;, &quot;srcfile&quot;: &quot;/srv/repo/ops/server/conf/&quot;}, &quot;msg&quot;: &quot;attempted to take checksum of directory: /srv/repo/ops/server/conf/&quot;}"><pre class="notranslate"><code class="notranslate">failed: [x.x.x.x] =&gt; (item={u'dstfile': u'/srv/server/conf/', u'srcfile': u'/srv/repo/ops/server/conf/'}) =&gt; {"failed": true, "invocation": {"module_args": {"backup": false, "content": null, "delimiter": null, "dest": "/srv/server/conf/", "directory_mode": null, "follow": false, "force": true, "group": null, "mode": null, "original_basename": null, "owner": null, "regexp": null, "remote_src": true, "selevel": null, "serole": null, "setype": null, "seuser": null, "src": "/srv/repo/ops/server/conf/", "validate": null}}, "item": {"dstfile": "/srv/server/conf/", "srcfile": "/srv/repo/ops/server/conf/"}, "msg": "attempted to take checksum of directory: /srv/repo/ops/server/conf/"}
</code></pre></div>
<p dir="auto">Copied from original issue: <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="128565302" data-permission-text="Title is private" data-url="https://github.com/ansible/ansible-modules-core/issues/2875" data-hovercard-type="issue" data-hovercard-url="/ansible/ansible-modules-core/issues/2875/hovercard" href="https://github.com/ansible/ansible-modules-core/issues/2875">ansible/ansible-modules-core#2875</a></p>