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

<ul dir="auto">
<li>Bug Report</li>
</ul>
<h5 dir="auto">COMPONENT NAME</h5>
<p dir="auto">ansible-playbook</p>
<h5 dir="auto">ANSIBLE VERSION</h5>

<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ansible 2.2.2.0"><pre class="notranslate"><code class="notranslate">ansible 2.2.2.0
</code></pre></div>
<h5 dir="auto">CONFIGURATION</h5>

<h5 dir="auto">OS / ENVIRONMENT</h5>

<p dir="auto">Debian Jessie</p>
<h5 dir="auto">SUMMARY</h5>

<p dir="auto">Duplicate role in a playbook is played only once, this changes behaviour compared to ansible-playbook 2.2.1.0</p>
<h5 dir="auto">STEPS TO REPRODUCE</h5>


<div class="highlight highlight-source-yaml notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="- hosts: my_hosts
  roles:
    - { role: a }
    - { role: a }"><pre class="notranslate">- <span class="pl-ent">hosts</span>: <span class="pl-s">my_hosts</span>
  <span class="pl-ent">roles</span>:
    - <span class="pl-s">{ role: a }</span>
    - <span class="pl-s">{ role: a }</span></pre></div>
<p dir="auto">Run:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ansible-playbook -i hosts playbook.yaml"><pre class="notranslate"><code class="notranslate">ansible-playbook -i hosts playbook.yaml
</code></pre></div>
<h5 dir="auto">EXPECTED RESULTS</h5>
<p dir="auto">with 2.2.1.0:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="PLAY [my_hosts] ****************************************************************

TASK [setup] *******************************************************************
ok: [my_host]

TASK [a : debug] ***************************************************************
ok: [my_host] =&gt; {
    &quot;msg&quot;: &quot;test a&quot;
}

TASK [a : debug] ***************************************************************
ok: [my_host] =&gt; {
    &quot;msg&quot;: &quot;test a&quot;
}

PLAY RECAP *********************************************************************
my_host            : ok=3    changed=0    unreachable=0    failed=0"><pre class="notranslate"><code class="notranslate">PLAY [my_hosts] ****************************************************************

TASK [setup] *******************************************************************
ok: [my_host]

TASK [a : debug] ***************************************************************
ok: [my_host] =&gt; {
    "msg": "test a"
}

TASK [a : debug] ***************************************************************
ok: [my_host] =&gt; {
    "msg": "test a"
}

PLAY RECAP *********************************************************************
my_host            : ok=3    changed=0    unreachable=0    failed=0
</code></pre></div>
<h5 dir="auto">ACTUAL RESULTS</h5>
<p dir="auto">with 2.2.2.0:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="PLAY [my_hosts] ****************************************************************

TASK [setup] *******************************************************************
ok: [my_host]

TASK [a : debug] ***************************************************************
ok: [my_host] =&gt; {
    &quot;msg&quot;: &quot;test a&quot;
}

PLAY RECAP *********************************************************************
my_host            : ok=2    changed=0    unreachable=0    failed=0"><pre class="notranslate"><code class="notranslate">PLAY [my_hosts] ****************************************************************

TASK [setup] *******************************************************************
ok: [my_host]

TASK [a : debug] ***************************************************************
ok: [my_host] =&gt; {
    "msg": "test a"
}

PLAY RECAP *********************************************************************
my_host            : ok=2    changed=0    unreachable=0    failed=0
</code></pre></div>
<h5 dir="auto">ISSUE TYPE</h5>
<ul dir="auto">
<li>Bug Report</li>
</ul>
<h5 dir="auto">COMPONENT NAME</h5>
<p dir="auto">ec2_ami_find</p>
<h5 dir="auto">ANSIBLE VERSION</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ansible 2.3.0.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/usr/share/ansible', u'library']
  python version = 2.7.13 (default, Apr  4 2017, 08:44:49) [GCC 4.2.1 Compatible Apple LLVM 7.0.2 (clang-700.1.81)]"><pre class="notranslate"><code class="notranslate">ansible 2.3.0.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/usr/share/ansible', u'library']
  python version = 2.7.13 (default, Apr  4 2017, 08:44:49) [GCC 4.2.1 Compatible Apple LLVM 7.0.2 (clang-700.1.81)]
</code></pre></div>
<h5 dir="auto">CONFIGURATION</h5>
<p dir="auto">pip install --upgrade ansible</p>
<h5 dir="auto">OS / ENVIRONMENT</h5>
<p dir="auto">MAC OSX</p>
<h5 dir="auto">SUMMARY</h5>
<p dir="auto">with ansible 2.2 ec2_ami_find was working. Right after the upgrade it started failing with 'Image' object has no attribute 'creationDate' error.<br>
I have quick workaround commenting out line 393 in ec2_ami_find.py but the playbook work only on my local laptop that way.</p>
<h5 dir="auto">STEPS TO REPRODUCE</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="    - name: Some name
      ec2_ami_find:
        aws_access_key: &quot;{{ aws_access_key }}&quot;
        aws_secret_key: &quot;{{ aws_secret_key }}&quot;
        region: &quot;{{ vpc_region }}&quot;
        name: &quot;myAMI-*&quot;
        sort: name
        sort_order: descending
        sort_end: 1
        no_result_action: fail
        state: available
      register: ami
"><pre class="notranslate"><code class="notranslate">    - name: Some name
      ec2_ami_find:
        aws_access_key: "{{ aws_access_key }}"
        aws_secret_key: "{{ aws_secret_key }}"
        region: "{{ vpc_region }}"
        name: "myAMI-*"
        sort: name
        sort_order: descending
        sort_end: 1
        no_result_action: fail
        state: available
      register: ami

</code></pre></div>
<h5 dir="auto">EXPECTED RESULTS</h5>
<p dir="auto">to return AMIs</p>
<h5 dir="auto">ACTUAL RESULTS</h5>
<p dir="auto">Using module file /usr/local/lib/python2.7/site-packages/ansible/modules/cloud/amazon/ec2_ami_find.py<br>
 ESTABLISH LOCAL CONNECTION FOR USER: ysimeonov<br>
 EXEC /bin/sh -c 'echo ~ &amp;&amp; sleep 0'<br>
 EXEC /bin/sh -c '( umask 77 &amp;&amp; mkdir -p "<code class="notranslate">echo /Users/ysimeonov/.ansible/tmp/ansible-tmp-1493146368.66-222958382107587</code>" &amp;&amp; echo ansible-tmp-1493146368.66-222958382107587="<code class="notranslate">echo /Users/ysimeonov/.ansible/tmp/ansible-tmp-1493146368.66-222958382107587</code>" ) &amp;&amp; sleep 0'<br>
 PUT /var/folders/6f/dxlpfp7521s25qc6gk1pr4jr0000gp/T/tmpQeCvFU TO /Users/ysimeonov/.ansible/tmp/ansible-tmp-1493146368.66-222958382107587/ec2_ami_find.py<br>
 EXEC /bin/sh -c 'chmod u+x /Users/ysimeonov/.ansible/tmp/ansible-tmp-1493146368.66-222958382107587/ /Users/ysimeonov/.ansible/tmp/ansible-tmp-1493146368.66-222958382107587/ec2_ami_find.py &amp;&amp; sleep 0'<br>
 EXEC /bin/sh -c '/usr/bin/python /Users/ysimeonov/.ansible/tmp/ansible-tmp-1493146368.66-222958382107587/ec2_ami_find.py; rm -rf "/Users/ysimeonov/.ansible/tmp/ansible-tmp-1493146368.66-222958382107587/" &gt; /dev/null 2&gt;&amp;1 &amp;&amp; sleep 0'<br>
The full traceback is:<br>
Traceback (most recent call last):<br>
File "/var/folders/6f/dxlpfp7521s25qc6gk1pr4jr0000gp/T/ansible_DzojF6/ansible_module_ec2_ami_find.py", line 439, in <br>
main()<br>
File "/var/folders/6f/dxlpfp7521s25qc6gk1pr4jr0000gp/T/ansible_DzojF6/ansible_module_ec2_ami_find.py", line 393, in main<br>
'creationDate': image.creationDate,<br>
AttributeError: 'Image' object has no attribute 'creationDate'</p>
<p dir="auto">fatal: [localhost]: FAILED! =&gt; {<br>
"changed": false,<br>
"failed": true,<br>
"module_stderr": "Traceback (most recent call last):\n  File "/var/folders/6f/dxlpfp7521s25qc6gk1pr4jr0000gp/T/ansible_DzojF6/ansible_module_ec2_ami_find.py", line 439, in \n    main()\n  File "/var/folders/6f/dxlpfp7521s25qc6gk1pr4jr0000gp/T/ansible_DzojF6/ansible_module_ec2_ami_find.py", line 393, in main\n    'creationDate': image.creationDate,\nAttributeError: 'Image' object has no attribute 'creationDate'\n",<br>
"module_stdout": "",<br>
"msg": "MODULE FAILURE",<br>
"rc": 0<br>
}</p>