<p dir="auto">This is with devel as of <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/ansible/ansible/commit/61d283e2ad58916d640b129cdd0b1ef866bcb332/hovercard" href="https://github.com/ansible/ansible/commit/61d283e2ad58916d640b129cdd0b1ef866bcb332"><tt>61d283e</tt></a></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ cat test.yaml
- name: derp
  hosts: localhost
  gather_facts: no
  connection: local

  tasks:
    - name: derp
      command: echo

$ ansible-playbook -i foo.com, test.yaml -vv

PLAY [derp] *******************************************************************
ERROR: host not found: localhost

$ ansible-playbook -i foo.com, test.yaml -vv --list-hosts

playbook: test.yaml

  play #1 (derp): host count=1
    localhost"><pre class="notranslate"><code class="notranslate">$ cat test.yaml
- name: derp
  hosts: localhost
  gather_facts: no
  connection: local

  tasks:
    - name: derp
      command: echo

$ ansible-playbook -i foo.com, test.yaml -vv

PLAY [derp] *******************************************************************
ERROR: host not found: localhost

$ ansible-playbook -i foo.com, test.yaml -vv --list-hosts

playbook: test.yaml

  play #1 (derp): host count=1
    localhost
</code></pre></div>
<p dir="auto">When I did some quick digging it appears to be a problem somewhere in attempting to insert variable data. I will do some more digging, but wanted to get the simple reproducer logged here.</p>
<h5 dir="auto">ISSUE TYPE</h5>
<ul dir="auto">
<li>Bug Report</li>
</ul>
<h5 dir="auto">COMPONENT NAME</h5>
<p dir="auto">docker_container</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 = /home/marcel/Projects/foo/ansible.cfg
  configured module search path = Default w/o overrides
  python version = 2.7.12 (default, Dec  4 2017, 14:50:18) [GCC 5.4.0 20160609]"><pre class="notranslate"><code class="notranslate">ansible 2.3.0.0
  config file = /home/marcel/Projects/foo/ansible.cfg
  configured module search path = Default w/o overrides
  python version = 2.7.12 (default, Dec  4 2017, 14:50:18) [GCC 5.4.0 20160609]
</code></pre></div>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ansible 2.4.3.0
  config file = None
  configured module search path = [u'/Users/marcel/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /Users/marcel/Projects/bugrq/ansibleDockerContainerHasChanged/lib/python2.7/site-packages/ansible
  executable location = /Users/marcel/Projects/bugrq/ansibleDockerContainerHasChanged/bin/ansible
  python version = 2.7.14 (default, Feb 15 2018, 23:05:14) [GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.39.2)]"><pre class="notranslate"><code class="notranslate">ansible 2.4.3.0
  config file = None
  configured module search path = [u'/Users/marcel/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /Users/marcel/Projects/bugrq/ansibleDockerContainerHasChanged/lib/python2.7/site-packages/ansible
  executable location = /Users/marcel/Projects/bugrq/ansibleDockerContainerHasChanged/bin/ansible
  python version = 2.7.14 (default, Feb 15 2018, 23:05:14) [GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.39.2)]
</code></pre></div>
<p dir="auto">but as I see the code in doubt is the same for ansible 2.4 and 2.5</p>
<h5 dir="auto">CONFIGURATION</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="[defaults]
hash_behaviour = merge
display_skipped_hosts = False
display_args_to_stdout = False
retry_files_enabled = False # Do not create them
record_host_keys = False
host_key_checking = False
callback_whitelist = profile_tasks

## ansible 2.1 https://github.com/ansible/ansible/blob/7f30324/docsite/rst/faq.rst#how-do-i-disable-cowsay
nocows=1"><pre class="notranslate"><code class="notranslate">[defaults]
hash_behaviour = merge
display_skipped_hosts = False
display_args_to_stdout = False
retry_files_enabled = False # Do not create them
record_host_keys = False
host_key_checking = False
callback_whitelist = profile_tasks

## ansible 2.1 https://github.com/ansible/ansible/blob/7f30324/docsite/rst/faq.rst#how-do-i-disable-cowsay
nocows=1
</code></pre></div>
<h5 dir="auto">OS / ENVIRONMENT</h5>
<p dir="auto">N/A</p>
<h5 dir="auto">SUMMARY</h5>
<p dir="auto">using the docker_container playbook, it ignores changes in ENV if only a ENV has been deleted from the list.<br>
It re-creates the container, if an env has been added.<br>
It doesn't touch the container, if an env has been deleted.</p>
<p dir="auto">reproducable with even present or started</p>
<p dir="auto">I doubt, there is an error in<br>
<a href="https://github.com/ansible/ansible/blob/stable-2.3/lib/ansible/modules/cloud/docker/docker_container.py#L1189">https://github.com/ansible/ansible/blob/stable-2.3/lib/ansible/modules/cloud/docker/docker_container.py#L1189</a></p>
<p dir="auto">and it's inner <code class="notranslate">compare_dict</code><br>
<a href="https://github.com/ansible/ansible/blob/stable-2.3/lib/ansible/modules/cloud/docker/docker_container.py#L1327">https://github.com/ansible/ansible/blob/stable-2.3/lib/ansible/modules/cloud/docker/docker_container.py#L1327</a></p>
<h5 dir="auto">STEPS TO REPRODUCE</h5>
<p dir="auto"><a href="https://gist.github.com/childnode/50295370e2fc79a10847411826210de2">https://gist.github.com/childnode/50295370e2fc79a10847411826210de2</a></p>
<p dir="auto">./build.sh<br>
./start.sh</p>
<h5 dir="auto">EXPECTED RESULTS</h5>
<p dir="auto">docker container is "changed" even just a ENV has been deleted</p>
<h5 dir="auto">ACTUAL RESULTS</h5>
<p dir="auto">docker container stays as it is, configuration is not evaluated as being changed for deleted envs</p>