<h5 dir="auto">ISSUE TYPE</h5>
<p dir="auto">Feature Idea</p>
<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="ansible 2.0.1.0"><pre class="notranslate"><code class="notranslate">ansible 2.0.1.0
</code></pre></div>
<h5 dir="auto">CONFIGURATION</h5>
<h5 dir="auto">OS / ENVIRONMENT</h5>
<h5 dir="auto">SUMMARY</h5>
<p dir="auto">shell (and probably command) modules have a <code class="notranslate">creates</code> parameter. The command is not run when the target file exists. When a playbook is executed with <code class="notranslate">--check</code> option, the task is skipped even when the target file exists. It is then difficult to know if the shell command would have been executed in normal mode.</p>
<h5 dir="auto">STEPS TO REPRODUCE</h5>
<p dir="auto">have a task using the <code class="notranslate">shell</code> module and specify a <code class="notranslate">creates</code> file.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="- name: ensure ecdsa key is present
  shell: ssh-keygen -N '' -t ecdsa -f /etc/ssh/ssh_host_ecdsa_key creates=/etc/ssh/ssh_host_ecdsa_key"><pre class="notranslate"><code class="notranslate">- name: ensure ecdsa key is present
  shell: ssh-keygen -N '' -t ecdsa -f /etc/ssh/ssh_host_ecdsa_key creates=/etc/ssh/ssh_host_ecdsa_key
</code></pre></div>
<p dir="auto">run the playbook with <code class="notranslate">--check</code> option</p>
<h5 dir="auto">EXPECTED RESULTS</h5>
<p dir="auto">Any information telling that the target already exists so there is no need to run the task.</p>
<h5 dir="auto">ACTUAL RESULTS</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="TASK [ensure ecdsa key is present]
skipping: [your_host]"><pre class="notranslate"><code class="notranslate">TASK [ensure ecdsa key is present]
skipping: [your_host]
</code></pre></div>
<p dir="auto">the task marked is skipped even when the file exists.</p>
<h5 dir="auto">Issue Type:</h5>
<ul dir="auto">
<li>Bug Report</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.0.1.0
  config file = /home/yannik/ansible/ansible.cfg
  configured module search path = Default w/o overrides"><pre class="notranslate"><code class="notranslate">ansible 2.0.1.0
  config file = /home/yannik/ansible/ansible.cfg
  configured module search path = Default w/o overrides
</code></pre></div>
<h5 dir="auto">Ansible Configuration:</h5>
<p dir="auto">default</p>
<h5 dir="auto">Environment:</h5>
<p dir="auto">fedora</p>
<h5 dir="auto">Summary:</h5>
<p dir="auto">The synchronize module hangs indefinitely if used to synchronize a file between two remote hosts with the delegate_to option.</p>
<h5 dir="auto">Steps To Reproduce:</h5>
<p dir="auto">This is the task I am using:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="- synchronize: 
    src: /test
    dest: /test
  delegate_to: HOST"><pre class="notranslate"><code class="notranslate">- synchronize: 
    src: /test
    dest: /test
  delegate_to: HOST
</code></pre></div>
<p dir="auto">Doing this, I want to copy from <code class="notranslate">HOST:/test</code> to <code class="notranslate">/test</code> of the inventory host currently running the playbook as described in the <a href="https://docs.ansible.com/ansible/synchronize_module.html" rel="nofollow">documentation</a></p>
<h5 dir="auto">Expected Results:</h5>
<p dir="auto">The file should be copied.</p>
<h5 dir="auto">Actual Results:</h5>
<p dir="auto">The command hangs indefinitely:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="TASK [rsnapshot-remote-host : Copy ssh key of backup pulling host] *************
task path: /home/yannik/ansible/roles/rsnapshot-remote-host/tasks/rsnapshot.yml:9
&lt;INVENTORY_HOST&gt; ESTABLISH SSH CONNECTION FOR USER: root
&lt;INVENTORY_HOST&gt; SSH: EXEC ssh -C -vvv -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 -o ControlPath=/home/yannik/.ansible/cp/ansible-ssh-%h-%p-%r -tt INVENTORY_HOST '/bin/sh -c '&quot;'&quot;'mkdir -p &quot;` echo $HOME/.ansible/tmp/ansible-tmp-1458571444.47-273656313378136 `&quot; &amp;&amp; echo &quot;` echo $HOME/.ansible/tmp/ansible-tmp-1458571444.47-273656313378136 `&quot;'&quot;'&quot;''
&lt;INVENTORY_HOST&gt; PUT /tmp/tmpv0BDhp TO /root/.ansible/tmp/ansible-tmp-1458571444.47-273656313378136/synchronize
&lt;INVENTORY_HOST&gt; SSH: EXEC sftp -b - -C -vvv -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 -o ControlPath=/home/yannik/.ansible/cp/ansible-ssh-%h-%p-%r '[INVENTORY_HOST]'
&lt;INVENTORY_HOST&gt; ESTABLISH SSH CONNECTION FOR USER: root
&lt;INVENTORY_HOST&gt; SSH: EXEC ssh -C -vvv -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 -o ControlPath=/home/yannik/.ansible/cp/ansible-ssh-%h-%p-%r -tt INVENTORY_HOST '/bin/sh -c '&quot;'&quot;'LANG=de_DE.UTF-8 LC_ALL=de_DE.UTF-8 LC_MESSAGES=de_DE.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1458571444.47-273656313378136/synchronize; rm -rf &quot;/root/.ansible/tmp/ansible-tmp-1458571444.47-273656313378136/&quot; &gt; /dev/null 2&gt;&amp;1'&quot;'&quot;''
^C [ERROR]: User interrupted execution"><pre class="notranslate"><code class="notranslate">TASK [rsnapshot-remote-host : Copy ssh key of backup pulling host] *************
task path: /home/yannik/ansible/roles/rsnapshot-remote-host/tasks/rsnapshot.yml:9
&lt;INVENTORY_HOST&gt; ESTABLISH SSH CONNECTION FOR USER: root
&lt;INVENTORY_HOST&gt; SSH: EXEC ssh -C -vvv -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 -o ControlPath=/home/yannik/.ansible/cp/ansible-ssh-%h-%p-%r -tt INVENTORY_HOST '/bin/sh -c '"'"'mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1458571444.47-273656313378136 `" &amp;&amp; echo "` echo $HOME/.ansible/tmp/ansible-tmp-1458571444.47-273656313378136 `"'"'"''
&lt;INVENTORY_HOST&gt; PUT /tmp/tmpv0BDhp TO /root/.ansible/tmp/ansible-tmp-1458571444.47-273656313378136/synchronize
&lt;INVENTORY_HOST&gt; SSH: EXEC sftp -b - -C -vvv -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 -o ControlPath=/home/yannik/.ansible/cp/ansible-ssh-%h-%p-%r '[INVENTORY_HOST]'
&lt;INVENTORY_HOST&gt; ESTABLISH SSH CONNECTION FOR USER: root
&lt;INVENTORY_HOST&gt; SSH: EXEC ssh -C -vvv -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 -o ControlPath=/home/yannik/.ansible/cp/ansible-ssh-%h-%p-%r -tt INVENTORY_HOST '/bin/sh -c '"'"'LANG=de_DE.UTF-8 LC_ALL=de_DE.UTF-8 LC_MESSAGES=de_DE.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1458571444.47-273656313378136/synchronize; rm -rf "/root/.ansible/tmp/ansible-tmp-1458571444.47-273656313378136/" &gt; /dev/null 2&gt;&amp;1'"'"''
^C [ERROR]: User interrupted execution
</code></pre></div>