<h5 dir="auto">ISSUE TYPE</h5>
<ul dir="auto">
<li>Bug Report</li>
</ul>
<h5 dir="auto">COMPONENT NAME</h5>
<ul dir="auto">
<li>docker_image</li>
</ul>
<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
  config file =
  configured module search path = Default w/o overrides"><pre class="notranslate"><code class="notranslate">ansible 2.3.0
  config file =
  configured module search path = Default w/o overrides
</code></pre></div>
<h5 dir="auto">CONFIGURATION</h5>
<p dir="auto">None</p>
<h5 dir="auto">OS / ENVIRONMENT</h5>
<p dir="auto">N/A</p>
<h5 dir="auto">SUMMARY</h5>
<p dir="auto">Pulling a docker image without force=yes always returns <code class="notranslate">unchanged</code> even if the image have newest version on DockerHub.<br>
But if I use <code class="notranslate">force=yes</code> workaround - it always returns <code class="notranslate">changed</code>, even if I already have latest image version.<br>
So, I think it must be another flag, something like <code class="notranslate">pull=always</code> or same, to always pull latest image, but stay unchanged, if nothing to do.</p>
<h5 dir="auto">STEPS TO REPRODUCE</h5>
<p dir="auto">The following task always return changed even when the image is in its latest version.</p>
<div class="highlight highlight-source-yaml notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="  tasks:
    - name: Download busybox image
      docker_image: name=busybox state=present force=yes"><pre class="notranslate">  <span class="pl-ent">tasks</span>:
    - <span class="pl-ent">name</span>: <span class="pl-s">Download busybox image</span>
      <span class="pl-ent">docker_image</span>: <span class="pl-s">name=busybox state=present force=yes</span></pre></div>
<p dir="auto">But running docker pull from shell you could tell if the image was updated or not</p>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="# docker pull busybox
Using default tag: latest
latest: Pulling from library/busybox

56bec22e3559: Pull complete
Digest: sha256:29f5d56d12684887bdfa50dcd29fc31eea4aaf4ad3bec43daf19026a7ce69912
Status: Downloaded newer image for busybox:latest

# docker pull busybox
Using default tag: latest
latest: Pulling from library/busybox

Digest: sha256:29f5d56d12684887bdfa50dcd29fc31eea4aaf4ad3bec43daf19026a7ce69912
Status: Image is up to date for busybox:latest"><pre class="notranslate"><span class="pl-c"><span class="pl-c">#</span> docker pull busybox</span>
Using default tag: latest
latest: Pulling from library/busybox

56bec22e3559: Pull <span class="pl-c1">complete</span>
Digest: sha256:29f5d56d12684887bdfa50dcd29fc31eea4aaf4ad3bec43daf19026a7ce69912
Status: Downloaded newer image <span class="pl-k">for</span> busybox:latest

<span class="pl-c"><span class="pl-c">#</span> docker pull busybox</span>
Using default tag: latest
latest: Pulling from library/busybox

Digest: sha256:29f5d56d12684887bdfa50dcd29fc31eea4aaf4ad3bec43daf19026a7ce69912
Status: Image is up to date <span class="pl-k">for</span> busybox:latest</pre></div>
<h5 dir="auto">EXPECTED RESULTS</h5>
<p dir="auto">It should return unchanged if the image was not updated.</p>
<h5 dir="auto">ACTUAL RESULTS</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="TASK [Download Download busybox image] *********************************
Thursday 03 November 2016  11:03:34 -0500 (0:00:00.567)       0:00:00.580 *****
changed: [example.com] =&gt; {&quot;actions&quot;: [&quot;Pulled image busybox:latest&quot;], &quot;changed&quot;:  true, &quot;image&quot;: {&quot;Architecture&quot;: &quot;amd64&quot;, &quot;Author&quot;: &quot;&quot;, &quot;Comment&quot;: &quot;&quot;, &quot;Config&quot;: {&quot;AttachStderr&quot;: false, &quot;AttachStdin&quot;: false, &quot;AttachStdout&quot;: false, &quot;Cmd&quot;: [&quot;sh&quot;], &quot;Domainname&quot;: &quot;&quot;, &quot;Entrypoint&quot;: null, &quot;Env&quot;: [&quot;PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin&quot;], &quot;Hostname&quot;: &quot;4a74292706a0&quot;, &quot;Image&quot;: &quot;sha256:1679bae2167496818312013654f5c66a16e185d0a0f6b762b53c8558014457c6&quot;, &quot;Labels&quot;: {}, &quot;OnBuild&quot;: null, &quot;OpenStdin&quot;: false, &quot;StdinOnce&quot;: false, &quot;Tty&quot;: false, &quot;User&quot;: &quot;&quot;, &quot;Volumes&quot;: null, &quot;WorkingDir&quot;: &quot;&quot;}, &quot;Container&quot;: &quot;8bb318a3b4672c53a1747991c95fff3306eea13ec308740ebe0c81b56ece530f&quot;, &quot;ContainerConfig&quot;: {&quot;AttachStderr&quot;: false, &quot;AttachStdin&quot;: false, &quot;AttachStdout&quot;: false, &quot;Cmd&quot;: [&quot;/bin/sh&quot;, &quot;-c&quot;, &quot;#(nop) &quot;, &quot;CMD [\&quot;sh\&quot;]&quot;], &quot;Domainname&quot;: &quot;&quot;, &quot;Entrypoint&quot;: null, &quot;Env&quot;: [&quot;PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin&quot;], &quot;Hostname&quot;: &quot;4a74292706a0&quot;, &quot;Image&quot;: &quot;sha256:1679bae2167496818312013654f5c66a16e185d0a0f6b762b53c8558014457c6&quot;, &quot;Labels&quot;: {}, &quot;OnBuild&quot;: null, &quot;OpenStdin&quot;: false, &quot;StdinOnce&quot;: false, &quot;Tty&quot;: false, &quot;User&quot;: &quot;&quot;, &quot;Volumes&quot;: null, &quot;WorkingDir&quot;: &quot;&quot;}, &quot;Created&quot;: &quot;2016-10-07T21:03:58.469866982Z&quot;, &quot;DockerVersion&quot;: &quot;1.12.1&quot;, &quot;GraphDriver&quot;: {&quot;Data&quot;: null, &quot;Name&quot;: &quot;aufs&quot;}, &quot;Id&quot;: &quot;sha256:e02e811dd08fd49e7f6032625495118e63f597eb150403d02e3238af1df240ba&quot;, &quot;Os&quot;: &quot;linux&quot;, &quot;Parent&quot;: &quot;&quot;, &quot;RepoDigests&quot;: [&quot;busybox@sha256:29f5d56d12684887bdfa50dcd29fc31eea4aaf4ad3bec43daf19026a7ce69912&quot;], &quot;RepoTags&quot;: [&quot;busybox:latest&quot;], &quot;RootFS&quot;: {&quot;Layers&quot;: [&quot;sha256:e88b3f82283bc59d5e0df427c824e9f95557e661fcb0ea15fb0fb6f97760f9d9&quot;], &quot;Type&quot;: &quot;layers&quot;}, &quot;Size&quot;: 1093484, &quot;VirtualSize&quot;: 1093484}}"><pre lang="log" class="notranslate"><code class="notranslate">TASK [Download Download busybox image] *********************************
Thursday 03 November 2016  11:03:34 -0500 (0:00:00.567)       0:00:00.580 *****
changed: [example.com] =&gt; {"actions": ["Pulled image busybox:latest"], "changed":  true, "image": {"Architecture": "amd64", "Author": "", "Comment": "", "Config": {"AttachStderr": false, "AttachStdin": false, "AttachStdout": false, "Cmd": ["sh"], "Domainname": "", "Entrypoint": null, "Env": ["PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"], "Hostname": "4a74292706a0", "Image": "sha256:1679bae2167496818312013654f5c66a16e185d0a0f6b762b53c8558014457c6", "Labels": {}, "OnBuild": null, "OpenStdin": false, "StdinOnce": false, "Tty": false, "User": "", "Volumes": null, "WorkingDir": ""}, "Container": "8bb318a3b4672c53a1747991c95fff3306eea13ec308740ebe0c81b56ece530f", "ContainerConfig": {"AttachStderr": false, "AttachStdin": false, "AttachStdout": false, "Cmd": ["/bin/sh", "-c", "#(nop) ", "CMD [\"sh\"]"], "Domainname": "", "Entrypoint": null, "Env": ["PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"], "Hostname": "4a74292706a0", "Image": "sha256:1679bae2167496818312013654f5c66a16e185d0a0f6b762b53c8558014457c6", "Labels": {}, "OnBuild": null, "OpenStdin": false, "StdinOnce": false, "Tty": false, "User": "", "Volumes": null, "WorkingDir": ""}, "Created": "2016-10-07T21:03:58.469866982Z", "DockerVersion": "1.12.1", "GraphDriver": {"Data": null, "Name": "aufs"}, "Id": "sha256:e02e811dd08fd49e7f6032625495118e63f597eb150403d02e3238af1df240ba", "Os": "linux", "Parent": "", "RepoDigests": ["busybox@sha256:29f5d56d12684887bdfa50dcd29fc31eea4aaf4ad3bec43daf19026a7ce69912"], "RepoTags": ["busybox:latest"], "RootFS": {"Layers": ["sha256:e88b3f82283bc59d5e0df427c824e9f95557e661fcb0ea15fb0fb6f97760f9d9"], "Type": "layers"}, "Size": 1093484, "VirtualSize": 1093484}}
</code></pre></div>
<h3 dir="auto">Related issues</h3>
<p dir="auto">It is maybe duplicate of <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="187213459" data-permission-text="Title is private" data-url="https://github.com/ansible/ansible-modules-core/issues/5489" data-hovercard-type="issue" data-hovercard-url="/ansible/ansible-modules-core/issues/5489/hovercard" href="https://github.com/ansible/ansible-modules-core/issues/5489">ansible/ansible-modules-core#5489</a> , but is seems, that repo is locked, so I want to remind about it.</p>
<h5 dir="auto">ISSUE TYPE</h5>

<ul dir="auto">
<li>Bug Report</li>
</ul>
<h5 dir="auto">COMPONENT NAME</h5>
<p dir="auto">shell module and check mode</p>
<h5 dir="auto">ANSIBLE VERSION</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="[root@localhost ~]# ansible --version
ansible 1.9.4"><pre class="notranslate"><code class="notranslate">[root@localhost ~]# ansible --version
ansible 1.9.4
</code></pre></div>
<h5 dir="auto">CONFIGURATION</h5>
<p dir="auto">Tested with default ansible.cfg.</p>
<h5 dir="auto">OS / ENVIRONMENT</h5>
<p dir="auto">CentOS release 6.7 (Final) up-to-date.</p>
<h5 dir="auto">SUMMARY</h5>
<p dir="auto">Looks like we get two task statuses when running the <code class="notranslate">shell</code> module with <code class="notranslate">--check</code>.</p>
<h5 dir="auto">STEPS TO REPRODUCE</h5>
<ul dir="auto">
<li>Use the following inventory file:</li>
</ul>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="[local]
127.0.0.1 ansible_connection=local ansible_python_interpreter='/usr/bin/env python'"><pre class="notranslate"><code class="notranslate">[local]
127.0.0.1 ansible_connection=local ansible_python_interpreter='/usr/bin/env python'
</code></pre></div>
<ul dir="auto">
<li>On the following playbook:</li>
</ul>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="[root@localhost ~]# cat check.yml 

---

- hosts: all
  tasks:
    - name: 'Fail if not run with --check'
      shell: 'exit 1'"><pre class="notranslate"><code class="notranslate">[root@localhost ~]# cat check.yml 

---

- hosts: all
  tasks:
    - name: 'Fail if not run with --check'
      shell: 'exit 1'
</code></pre></div>
<ul dir="auto">
<li>Invoke with the following and get...:</li>
</ul>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="[root@localhost ~]# ansible-playbook -i inventory check.yml --check

PLAY [all] ******************************************************************** 

GATHERING FACTS *************************************************************** 
ok: [127.0.0.1]

TASK: [Fail if not run with --check] ****************************************** 
skipping: [127.0.0.1]
ok: [127.0.0.1]

PLAY RECAP ******************************************************************** 
127.0.0.1                  : ok=1    changed=0    unreachable=0    failed=0  "><pre class="notranslate"><code class="notranslate">[root@localhost ~]# ansible-playbook -i inventory check.yml --check

PLAY [all] ******************************************************************** 

GATHERING FACTS *************************************************************** 
ok: [127.0.0.1]

TASK: [Fail if not run with --check] ****************************************** 
skipping: [127.0.0.1]
ok: [127.0.0.1]

PLAY RECAP ******************************************************************** 
127.0.0.1                  : ok=1    changed=0    unreachable=0    failed=0  
</code></pre></div>
<h5 dir="auto">EXPECTED RESULTS</h5>
<p dir="auto">For our task to be "skipped" (this is what happens under ans-v2 at least).</p>
<h5 dir="auto">ACTUAL RESULTS</h5>
<p dir="auto">Task reported as both 'ok' and 'skipped.'</p>