<h5 dir="auto">ISSUE TYPE</h5>
<ul dir="auto">
<li>Bug Report</li>
</ul>
<h5 dir="auto">COMPONENT NAME</h5>
<p dir="auto">ec2_instance_facts</p>
<h5 dir="auto">ANSIBLE VERSION</h5>

<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ansible 2.4.0.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/home/jjabs/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.13 (default, Jul 21 2017, 03:24:34) [GCC 7.1.1 20170630]"><pre class="notranslate"><code class="notranslate">ansible 2.4.0.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/home/jjabs/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.13 (default, Jul 21 2017, 03:24:34) [GCC 7.1.1 20170630]
</code></pre></div>
<h5 dir="auto">CONFIGURATION</h5>
<p dir="auto">DEFAULT_CALLBACK_WHITELIST(/etc/ansible/ansible.cfg) = ['profile_tasks']<br>
DEFAULT_LOG_PATH(/etc/ansible/ansible.cfg) = /var/log/ansible.log<br>
HOST_KEY_CHECKING(/etc/ansible/ansible.cfg) = False</p>
<h5 dir="auto">OS / ENVIRONMENT</h5>
<p dir="auto">Manjaro 17</p>
<h5 dir="auto">SUMMARY</h5>
<p dir="auto">ec2_remote_facts deliver the instance tags as expected.<br>
The new module which should replace it (ec2_instance_facts) do not show instance tags.<br>
Easy to reproduce since you can easily switch the module name and use the same params.</p>
<h5 dir="auto">STEPS TO REPRODUCE</h5>
<p dir="auto">get_ec2_facts.yml</p>

<div class="highlight highlight-source-yaml notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="---
- ec2_instance_facts:
     region: &quot;your-region&quot;
     aws_access_key: &quot;your-key&quot;
     aws_secret_key: &quot;your-secret-key&quot;
   filters:
     instance-state-name:        running
     &quot;tag:Name&quot;: &quot;your-instance-name&quot;
  register: ec2_facts"><pre class="notranslate">---
- <span class="pl-ent">ec2_instance_facts</span>:
     <span class="pl-ent">region</span>: <span class="pl-s"><span class="pl-pds">"</span>your-region<span class="pl-pds">"</span></span>
     <span class="pl-ent">aws_access_key</span>: <span class="pl-s"><span class="pl-pds">"</span>your-key<span class="pl-pds">"</span></span>
     <span class="pl-ent">aws_secret_key</span>: <span class="pl-s"><span class="pl-pds">"</span>your-secret-key<span class="pl-pds">"</span></span>
   <span class="pl-ent">filters</span>:
     <span class="pl-ent">instance-state-name</span>:        <span class="pl-s">running</span>
     <span class="pl-s"><span class="pl-pds">"</span><span class="pl-ent">tag:Name</span><span class="pl-pds">"</span></span>: <span class="pl-s"><span class="pl-pds">"</span>your-instance-name<span class="pl-pds">"</span></span>
  <span class="pl-ent">register</span>: <span class="pl-s">ec2_facts</span></pre></div>
<h5 dir="auto">EXPECTED RESULTS</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ok: [localhost] =&gt; {
    &quot;ec2_facts&quot;: {
     .... bla bla bla
                }, 
                &quot;tags&quot;: {
                     &quot;key&quot;: &quot;value&quot;,
                     &quot;foo&quot;: &quot;bar&quot;
                 }, 
            }
        ]
    }
"><pre class="notranslate"><code class="notranslate">ok: [localhost] =&gt; {
    "ec2_facts": {
     .... bla bla bla
                }, 
                "tags": {
                     "key": "value",
                     "foo": "bar"
                 }, 
            }
        ]
    }

</code></pre></div>
<h5 dir="auto">ACTUAL RESULTS</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ok: [localhost] =&gt; {
    &quot;ec2_facts&quot;: {
     .... bla bla bla
                }, 
                &quot;tags&quot;: {}, 
            }
        ]
    }
"><pre class="notranslate"><code class="notranslate">ok: [localhost] =&gt; {
    "ec2_facts": {
     .... bla bla bla
                }, 
                "tags": {}, 
            }
        ]
    }

</code></pre></div>
<p dir="auto">Synchronize module adds unwanted path fragment to rsync destination when multiple items used (with_items)</p>
<p dir="auto">Part of task with synchronize action and with_items directive:</p>
<div class="highlight highlight-source-yaml notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="- name: 'SOLR | Deploy cores configuration files for instances'
  synchronize: src=projects/{{project_name}}/core-conf/ dest=/opt/solr/home/cores/{{item.name}}/conf/ archive=yes delete=yes rsync_path=&quot;sudo rsync&quot;
  register: solrxml
  when: item.solr is defined and item.solr == 'present'
  with_items: instances
  tags:
    - solr
    - solr-conf
    - search"><pre class="notranslate">- <span class="pl-ent">name</span>: <span class="pl-s"><span class="pl-pds">'</span>SOLR | Deploy cores configuration files for instances<span class="pl-pds">'</span></span>
  <span class="pl-ent">synchronize</span>: <span class="pl-s">src=projects/{{project_name}}/core-conf/ dest=/opt/solr/home/cores/{{item.name}}/conf/ archive=yes delete=yes rsync_path="sudo rsync"</span>
  <span class="pl-ent">register</span>: <span class="pl-s">solrxml</span>
  <span class="pl-ent">when</span>: <span class="pl-s">item.solr is defined and item.solr == 'present'</span>
  <span class="pl-ent">with_items</span>: <span class="pl-s">instances</span>
  <span class="pl-ent">tags</span>:
    - <span class="pl-s">solr</span>
    - <span class="pl-s">solr-conf</span>
    - <span class="pl-s">search</span></pre></div>
<p dir="auto">Got output:</p>
<blockquote>
<p dir="auto">TASK: [solr | SOLR | Deploy cores configuration files for instances] **********<br>
&lt;127.0.0.1&gt; EXEC ['/bin/sh', '-c', 'mkdir -p $HOME/.ansible/tmp/ansible-1383930775.88-164589547782291 &amp;&amp; chmod a+rx $HOME/.ansible/tmp/ansible-1383930775.88-164589547782291 &amp;&amp; echo $HOME/.ansible/tmp/ansible-1383930775.88-164589547782291']<br>
&lt;127.0.0.1&gt; PUT /tmp/tmp6nU_52 TO /home/xt/.ansible/tmp/ansible-1383930775.88-164589547782291/synchronize<br>
&lt;127.0.0.1&gt; EXEC ['/bin/sh', '-c', '/usr/bin/env python /home/xt/.ansible/tmp/ansible-1383930775.88-164589547782291/synchronize; rm -rf /home/xt/.ansible/tmp/ansible-1383930775.88-164589547782291/ &gt;/dev/null 2&gt;&amp;1']<br>
changed: [10.1.250.10] =&gt; (item={'autopull': 'present', 'cron': 'present', 'solr': 'present', 'name': 'dev', 'vhost': 'application', 'domains': 'dev.test.local', 'docroot': u'/var/www/dev', 'db': 'present', 'auth': 'present'}) =&gt; {"changed": true, "cmd": "rsync --delay-updates --compress --timeout=10 --delete-after --archive --rsh 'ssh  -o StrictHostKeyChecking=no' --rsync-path 'sudo rsync' --out-format='&lt;&gt;%i %n%L' projects/test/core-conf/ vagrant@10.1.250.10:/opt/solr/home/cores/dev/conf/", "item": {"auth": "present", "autopull": "present", "cron": "present", "db": "present", "docroot": "/var/www/dev", "domains": "dev.test.local", "name": "dev", "solr": "present", "vhost": "application"}, "msg": ".d....og... ./\n.f....og... admin-extra.html\n.f....og... currency.xml\n.f....og... elevate.xml\n.f....og... mapping-FoldToASCII.txt\n.f....og... mapping-ISOLatin1Accent.txt\n.f....og... protwords.txt\n.f....og... schema.xml\n.f....og... schema_extra_fields.xml\n.f....og... schema_extra_types.xml\n.f....og... scripts.conf\n.f....og... solrconfig.xml\n.f....og... solrconfig_extra.xml\n.f....og... solrcore.properties\n.f....og... spellings.txt\n.f....og... stopwords.txt\n.f....og... synonyms.txt\n.d....og... lang/\n.f....og... lang/contractions_ca.txt\n.f....og... lang/contractions_fr.txt\n.f....og... lang/contractions_ga.txt\n.f....og... lang/contractions_it.txt\n.f....og... lang/hyphenations_ga.txt\n.f....og... lang/stemdict_nl.txt\n.f....og... lang/stoptags_ja.txt\n.f....og... lang/stopwords_ar.txt\n.f....og... lang/stopwords_bg.txt\n.f....og... lang/stopwords_ca.txt\n.f....og... lang/stopwords_cz.txt\n.f....og... lang/stopwords_da.txt\n.f....og... lang/stopwords_de.txt\n.f....og... lang/stopwords_el.txt\n.f....og... lang/stopwords_en.txt\n.f....og... lang/stopwords_es.txt\n.f....og... lang/stopwords_eu.txt\n.f....og... lang/stopwords_fa.txt\n.f....og... lang/stopwords_fi.txt\n.f....og... lang/stopwords_fr.txt\n.f....og... lang/stopwords_ga.txt\n.f....og... lang/stopwords_gl.txt\n.f....og... lang/stopwords_hi.txt\n.f....og... lang/stopwords_hu.txt\n.f....og... lang/stopwords_hy.txt\n.f....og... lang/stopwords_id.txt\n.f....og... lang/stopwords_it.txt\n.f....og... lang/stopwords_ja.txt\n.f....og... lang/stopwords_lv.txt\n.f....og... lang/stopwords_nl.txt\n.f....og... lang/stopwords_no.txt\n.f....og... lang/stopwords_pt.txt\n.f....og... lang/stopwords_ro.txt\n.f....og... lang/stopwords_ru.txt\n.f....og... lang/stopwords_sv.txt\n.f....og... lang/stopwords_th.txt\n.f....og... lang/stopwords_tr.txt\n.f....og... lang/userdict_ja.txt\n.d....og... velocity/\n.f....og... velocity/VM_global_library.vm\n.f....og... velocity/browse.vm\n.f....og... velocity/cluster.vm\n.f....og... velocity/clusterResults.vm\n.f....og... velocity/doc.vm\n.f....og... velocity/facet_fields.vm\n.f....og... velocity/facet_queries.vm\n.f....og... velocity/facet_ranges.vm\n.f....og... velocity/facets.vm\n.f....og... velocity/footer.vm\n.f....og... velocity/head.vm\n.f....og... velocity/header.vm\n.f....og... velocity/hit.vm\n.f....og... velocity/hitGrouped.vm\n.f....og... velocity/jquery.autocomplete.css\n.f....og... velocity/jquery.autocomplete.js\n.f....og... velocity/layout.vm\n.f....og... velocity/main.css\n.f....og... velocity/query.vm\n.f....og... velocity/querySpatial.vm\n.f....og... velocity/suggest.vm\n.f....og... velocity/tabs.vm\n.d....og... xslt/\n.f....og... xslt/example.xsl\n.f....og... xslt/example_atom.xsl\n.f....og... xslt/example_rss.xsl\n.f....og... xslt/luke.xsl\n.f....og... xslt/updateXml.xsl\n", "rc": 0}<br>
&lt;127.0.0.1&gt; EXEC ['/bin/sh', '-c', 'mkdir -p $HOME/.ansible/tmp/ansible-1383930776.06-136953182056861 &amp;&amp; chmod a+rx $HOME/.ansible/tmp/ansible-1383930776.06-136953182056861 &amp;&amp; echo $HOME/.ansible/tmp/ansible-1383930776.06-136953182056861']<br>
&lt;127.0.0.1&gt; PUT /tmp/tmpKJBXPa TO /home/xt/.ansible/tmp/ansible-1383930776.06-136953182056861/synchronize<br>
&lt;127.0.0.1&gt; EXEC ['/bin/sh', '-c', '/usr/bin/env python /home/xt/.ansible/tmp/ansible-1383930776.06-136953182056861/synchronize; rm -rf /home/xt/.ansible/tmp/ansible-1383930776.06-136953182056861/ &gt;/dev/null 2&gt;&amp;1']<br>
failed: [10.1.250.10] =&gt; (item={'autopull': 'absent', 'cron': 'absent', 'solr': 'present', 'name': 'stage', 'vhost': 'static', 'domains': 'stage.test.local stg.test.local', 'docroot': u'/var/www/stage/current', 'db': 'present', 'auth': 'present'}) =&gt; {"cmd": "rsync --delay-updates --compress --timeout=10 --delete-after --archive --rsh 'ssh  -o StrictHostKeyChecking=no' --rsync-path 'sudo rsync' --out-format='&lt;&gt;%i %n%L' projects/test/core-conf/ vagrant@10.1.250.10:vagrant@10.1.250.10:/opt/solr/home/cores/dev/conf/", "failed": true, "item": {"auth": "present", "autopull": "absent", "cron": "absent", "db": "present", "docroot": "/var/www/stage/current", "domains": "stage.test.local stg.test.local", "name": "stage", "solr": "present", "vhost": "static"}, "rc": 12}<br>
msg: rsync: mkdir "/home/vagrant/vagrant@10.1.250.10:/opt/solr/home/cores/dev/conf" failed: No such file or directory (2)<br>
rsync error: error in file IO (code 11) at main.c(605) [Receiver=3.0.9]<br>
rsync: connection unexpectedly closed (197 bytes received so far) [sender]<br>
rsync error: error in rsync protocol data stream (code 12) at io.c(226) [sender=3.1.0]</p>
</blockquote>
<p dir="auto">Some of options got duplicated for second item</p>
<p dir="auto">Ansible: v1.4 (devel)<br>
Python: 2.7</p>