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

<ul dir="auto">
<li>Bug Report</li>
</ul>
<h5 dir="auto">COMPONENT NAME</h5>

<p dir="auto">core</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.0.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = Default w/o overrides"><pre class="notranslate"><code class="notranslate">ansible 2.2.0.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = Default w/o overrides
</code></pre></div>
<h5 dir="auto">CONFIGURATION</h5>

<p dir="auto">This bug is related to <a href="https://github.com/openstack/tripleo-quickstart">tripleo-quickstart</a>, an Ansible based project for setting up TripleO virtual environments, which customizes the conf as follows:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="[defaults]
command_warnings = False
retry_files_enabled = False
callback_whitelist = profile_tasks
host_key_checking = False
force_color = 1

# Attempt to load custom modules whether it's installed system-wide or from a virtual environment
callback_plugins = /usr/lib/python2.7/site-packages/ara/plugins/callbacks:$VIRTUAL_ENV/lib/python2.7/site-packages/ara/plugins/callbacks:/usr/local/lib/python2.7/dist-packages/ara/plugins/callbacks
test_plugins = /usr/lib/python2.7/site-packages/tripleo-quickstart/test_plugins:$VIRTUAL_ENV/usr/local/share/tripleo-quickstart/test_plugins:test_plugins
library = /usr/lib/python2.7/site-packages/tripleo-quickstart/library:$VIRTUAL_ENV/usr/local/share/tripleo-quickstart/library:library
roles_path = roles:$VIRTUAL_ENV/usr/local/share/tripleo-quickstart/roles:$VIRTUAL_ENV/usr/local/share/ansible/roles

[ssh_connection]
control_path = %(directory)s/%%h-%%r"><pre class="notranslate"><code class="notranslate">[defaults]
command_warnings = False
retry_files_enabled = False
callback_whitelist = profile_tasks
host_key_checking = False
force_color = 1

# Attempt to load custom modules whether it's installed system-wide or from a virtual environment
callback_plugins = /usr/lib/python2.7/site-packages/ara/plugins/callbacks:$VIRTUAL_ENV/lib/python2.7/site-packages/ara/plugins/callbacks:/usr/local/lib/python2.7/dist-packages/ara/plugins/callbacks
test_plugins = /usr/lib/python2.7/site-packages/tripleo-quickstart/test_plugins:$VIRTUAL_ENV/usr/local/share/tripleo-quickstart/test_plugins:test_plugins
library = /usr/lib/python2.7/site-packages/tripleo-quickstart/library:$VIRTUAL_ENV/usr/local/share/tripleo-quickstart/library:library
roles_path = roles:$VIRTUAL_ENV/usr/local/share/tripleo-quickstart/roles:$VIRTUAL_ENV/usr/local/share/ansible/roles

[ssh_connection]
control_path = %(directory)s/%%h-%%r
</code></pre></div>
<p dir="auto">So nothing that seems related to the problem I'm getting.</p>
<h5 dir="auto">OS / ENVIRONMENT</h5>

<p dir="auto">CentOS Linux release 7.3.1611 (Core)</p>
<h5 dir="auto">SUMMARY</h5>

<p dir="auto">Until ansible 2.1.0 this section of my main task always worked:</p>
<div class="highlight highlight-source-yaml notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="- name: Get overcloud-ha-test-suite on undercloud and controllers
  vars:
    nodes:
      - &quot;undercloud&quot;
      - &quot;{{ groups['controller'] }}&quot;
  shell: &gt;
    rm -rf tripleo-director-ha-test-suite;
    git clone https://github.com/rscarazz/tripleo-director-ha-test-suite/ tripleo-director-ha-test-suite;
  delegate_to: &quot;{{ item }}&quot;
  with_items: &quot;{{ nodes }}&quot;"><pre class="notranslate">- <span class="pl-ent">name</span>: <span class="pl-s">Get overcloud-ha-test-suite on undercloud and controllers</span>
  <span class="pl-ent">vars</span>:
    <span class="pl-ent">nodes</span>:
      - <span class="pl-s"><span class="pl-pds">"</span>undercloud<span class="pl-pds">"</span></span>
      - <span class="pl-s"><span class="pl-pds">"</span>{{ groups['controller'] }}<span class="pl-pds">"</span></span>
  <span class="pl-ent">shell</span>: <span class="pl-s">&gt;</span>
<span class="pl-s">    rm -rf tripleo-director-ha-test-suite;</span>
<span class="pl-s">    git clone https://github.com/rscarazz/tripleo-director-ha-test-suite/ tripleo-director-ha-test-suite;</span>
<span class="pl-s"></span>  <span class="pl-ent">delegate_to</span>: <span class="pl-s"><span class="pl-pds">"</span>{{ item }}<span class="pl-pds">"</span></span>
  <span class="pl-ent">with_items</span>: <span class="pl-s"><span class="pl-pds">"</span>{{ nodes }}<span class="pl-pds">"</span></span></pre></div>
<p dir="auto">Each element of nodes exists and is taken from the correctly populated inventory.<br>
After upgrading to ansible 2.2.0 a strange behavior happens, the section fails because {{ item }} takes values like "skipped" and "changed" making ssh connections failing.<br>
Issue was solved by <a href="https://github.com/openstack/tripleo-quickstart-extras/commit/b97b13b83ce191ee235e1fa6499c63a177f099d8">this commit</a>, with this modification:</p>
<div class="highlight highlight-source-yaml notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="- name: Get overcloud-ha-test-suite on undercloud and controllers
  shell: &gt;
    rm -rf tripleo-director-ha-test-suite;
    git clone https://github.com/rscarazz/tripleo-director-ha-test-suite/ tripleo-director-ha-test-suite;
  delegate_to: &quot;{{ item }}&quot;
  with_items:
    - &quot;undercloud&quot;
- &quot;{{ groups['controller'] }}&quot;"><pre class="notranslate">- <span class="pl-ent">name</span>: <span class="pl-s">Get overcloud-ha-test-suite on undercloud and controllers</span>
  <span class="pl-ent">shell</span>: <span class="pl-s">&gt;</span>
<span class="pl-s">    rm -rf tripleo-director-ha-test-suite;</span>
<span class="pl-s">    git clone https://github.com/rscarazz/tripleo-director-ha-test-suite/ tripleo-director-ha-test-suite;</span>
<span class="pl-s"></span>  <span class="pl-ent">delegate_to</span>: <span class="pl-s"><span class="pl-pds">"</span>{{ item }}<span class="pl-pds">"</span></span>
  <span class="pl-ent">with_items</span>:
    - <span class="pl-s"><span class="pl-pds">"</span>undercloud<span class="pl-pds">"</span></span>
- <span class="pl-s"><span class="pl-pds">"</span>{{ groups['controller'] }}<span class="pl-pds">"</span></span></pre></div>
<p dir="auto">but I think it should work in both cases.</p>
<h5 dir="auto">STEPS TO REPRODUCE</h5>

<p dir="auto">To reproduce the problem simply use the code above, trying to run the action after creating an inventory with expected elements, "undercloud" and "{{ groups['controller'] }}" (usually a 3 elements array).</p>


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

<p dir="auto">Execution of the action, without any error in both cases.</p>
<h5 dir="auto">ACTUAL RESULTS</h5>

<p dir="auto">As one can see from the output the host on which the action is taken is "skipped" and not the hostname as expected:</p>

<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="14:59:42 &lt;skipped&gt; ESTABLISH SSH CONNECTION FOR USER: None
14:59:42 &lt;skipped&gt; SSH: EXEC ssh -vvv -F workspace/ssh.config.ansible -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 skipped '/bin/sh -c '&quot;'&quot;'( umask 77 &amp;&amp; mkdir -p &quot;` echo $HOME/.ansible/tmp/ansible-tmp-1485269982.15-73426610894136 `&quot; &amp;&amp; echo ansible-tmp-1485269982.15-73426610894136=&quot;` echo $HOME/.ansible/tmp/ansible-tmp-1485269982.15-73426610894136 `&quot; ) &amp;&amp; sleep 0'&quot;'&quot;''
14:59:42 failed: [undercloud] (item=skipped) =&gt; {
14:59:42     &quot;item&quot;: &quot;skipped&quot;, 
14:59:42     &quot;msg&quot;: &quot;Failed to connect to the host via ssh: OpenSSH_6.6.1, OpenSSL 1.0.1e-fips 11 Feb 2013\r\ndebug1: Reading configuration data workspace/ssh.config.ansible\r\ndebug1: workspace/ssh.config.ansible line 2: Applying options for *\r\nssh: Could not resolve hostname skipped: Name or service not known\r\n&quot;, 
14:59:42     &quot;unreachable&quot;: true
14:59:42 }"><pre class="notranslate"><code class="notranslate">14:59:42 &lt;skipped&gt; ESTABLISH SSH CONNECTION FOR USER: None
14:59:42 &lt;skipped&gt; SSH: EXEC ssh -vvv -F workspace/ssh.config.ansible -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 skipped '/bin/sh -c '"'"'( umask 77 &amp;&amp; mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1485269982.15-73426610894136 `" &amp;&amp; echo ansible-tmp-1485269982.15-73426610894136="` echo $HOME/.ansible/tmp/ansible-tmp-1485269982.15-73426610894136 `" ) &amp;&amp; sleep 0'"'"''
14:59:42 failed: [undercloud] (item=skipped) =&gt; {
14:59:42     "item": "skipped", 
14:59:42     "msg": "Failed to connect to the host via ssh: OpenSSH_6.6.1, OpenSSL 1.0.1e-fips 11 Feb 2013\r\ndebug1: Reading configuration data workspace/ssh.config.ansible\r\ndebug1: workspace/ssh.config.ansible line 2: Applying options for *\r\nssh: Could not resolve hostname skipped: Name or service not known\r\n", 
14:59:42     "unreachable": true
14:59:42 }
</code></pre></div>
<p dir="auto">Same is on the next error, but this time with "changed":</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="14:59:42 &lt;changed&gt; ESTABLISH SSH CONNECTION FOR USER: None
14:59:42 &lt;changed&gt; SSH: EXEC ssh -vvv -F workspace/ssh.config.ansible -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 changed '/bin/sh -c '&quot;'&quot;'( umask 77 &amp;&amp; mkdir -p &quot;` echo $HOME/.ansible/tmp/ansible-tmp-1485269982.24-237524239100501 `&quot; &amp;&amp; echo ansible-tmp-1485269982.24-237524239100501=&quot;` echo $HOME/.ansible/tmp/ansible-tmp-1485269982.24-237524239100501 `&quot; ) &amp;&amp; sleep 0'&quot;'&quot;''
14:59:42 failed: [undercloud] (item=changed) =&gt; {
14:59:42     &quot;item&quot;: &quot;changed&quot;, 
14:59:42     &quot;msg&quot;: &quot;Failed to connect to the host via ssh: OpenSSH_6.6.1, OpenSSL 1.0.1e-fips 11 Feb 2013\r\ndebug1: Reading configuration data workspace/ssh.config.ansible\r\ndebug1: workspace/ssh.config.ansible line 2: Applying options for *\r\nssh: Could not resolve hostname changed: Name or service not known\r\n&quot;, 
14:59:42     &quot;unreachable&quot;: true
14:59:42 }"><pre class="notranslate"><code class="notranslate">14:59:42 &lt;changed&gt; ESTABLISH SSH CONNECTION FOR USER: None
14:59:42 &lt;changed&gt; SSH: EXEC ssh -vvv -F workspace/ssh.config.ansible -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 changed '/bin/sh -c '"'"'( umask 77 &amp;&amp; mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1485269982.24-237524239100501 `" &amp;&amp; echo ansible-tmp-1485269982.24-237524239100501="` echo $HOME/.ansible/tmp/ansible-tmp-1485269982.24-237524239100501 `" ) &amp;&amp; sleep 0'"'"''
14:59:42 failed: [undercloud] (item=changed) =&gt; {
14:59:42     "item": "changed", 
14:59:42     "msg": "Failed to connect to the host via ssh: OpenSSH_6.6.1, OpenSSL 1.0.1e-fips 11 Feb 2013\r\ndebug1: Reading configuration data workspace/ssh.config.ansible\r\ndebug1: workspace/ssh.config.ansible line 2: Applying options for *\r\nssh: Could not resolve hostname changed: Name or service not known\r\n", 
14:59:42     "unreachable": true
14:59:42 }
</code></pre></div>
<p dir="auto">I don't know if this can be considered a duplicate of <a href="https://github.com/ansible/ansible/issues/11705" data-hovercard-type="issue" data-hovercard-url="/ansible/ansible/issues/11705/hovercard">this other issue</a>, since the behavior is slightly different, but maybe it is related.</p>
<p dir="auto">From <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/naslanidis/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/naslanidis">@naslanidis</a> on 2016-03-07T01:20:17Z</p>
<h5 dir="auto">Issue Type:</h5>
<ul dir="auto">
<li>Feature Idea</li>
</ul>
<h5 dir="auto">Component Name:</h5>
<ul dir="auto">
<li>ec2_vpc.py</li>
</ul>
<h5 dir="auto">Ansible Version:</h5>
<p dir="auto">ansible 2.0.0.2<br>
config file = /home/naslanidis/code/ag-vpc-management/ansible.cfg<br>
configured module search path = /usr/share/ansible/modules</p>
<h5 dir="auto">Ansible Configuration:</h5>
<p dir="auto">N/A</p>
<h5 dir="auto">Environment:</h5>
<p dir="auto">Fedora 22 x64</p>
<h5 dir="auto">Summary:</h5>
<p dir="auto">When creating VPC's using this module, if any tag is changed or added a completely new VPC is created rather than the tags being added or updated. Looking at the documentation, all tags are used along with the cidr range to uniquely identify an existing VPC. In my opinion this should just be a NAME tag and other tags should be able to be added, changed and removed for an existing VPC</p>
<h5 dir="auto">Steps To Reproduce:</h5>
<ol dir="auto">
<li>Create a VPC using this module with a number of tags in place</li>
<li>Add a new tag (e.g. cost code), and rerun the script</li>
<li>A new duplicate VPC is created rather than adding the cost code tag to the existing VPC</li>
</ol>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content=" - name: test out vpc module 1st run though
    ec2_vpc:
      state: present
      region: ap-southeast-2
      profile: non_prod
      cidr_block: 10.33.0.0/16
      resource_tags:
        Name: AAG-VPC-33
        Owner: ABC
    register: created_vpc"><pre class="notranslate"><code class="notranslate"> - name: test out vpc module 1st run though
    ec2_vpc:
      state: present
      region: ap-southeast-2
      profile: non_prod
      cidr_block: 10.33.0.0/16
      resource_tags:
        Name: AAG-VPC-33
        Owner: ABC
    register: created_vpc
</code></pre></div>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content=" - name: test out vpc module 2nd run though
    ec2_vpc:
      state: present
      region: ap-southeast-2
      profile: non_prod
      cidr_block: 10.33.0.0/16
      resource_tags:
        Name: AAG-VPC-33
        Owner: ABC
        Cost_code: 3
    register: created_vpc"><pre class="notranslate"><code class="notranslate"> - name: test out vpc module 2nd run though
    ec2_vpc:
      state: present
      region: ap-southeast-2
      profile: non_prod
      cidr_block: 10.33.0.0/16
      resource_tags:
        Name: AAG-VPC-33
        Owner: ABC
        Cost_code: 3
    register: created_vpc
</code></pre></div>
<h5 dir="auto">Expected Results:</h5>
<p dir="auto">The existing VPC should be updated with the new Cost_code tag.</p>
<h5 dir="auto">Actual Results:</h5>
<p dir="auto">A new VPC is created that duplicates the first VPC.</p>
<p dir="auto">Copied from original issue: <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="138859125" data-permission-text="Title is private" data-url="https://github.com/ansible/ansible-modules-core/issues/3194" data-hovercard-type="issue" data-hovercard-url="/ansible/ansible-modules-core/issues/3194/hovercard" href="https://github.com/ansible/ansible-modules-core/issues/3194">ansible/ansible-modules-core#3194</a></p>