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

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

<p dir="auto">pause</p>
<h5 dir="auto">ANSIBLE VERSION</h5>

<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ansible 2.5.0 (devel ca115b0a8e) last updated 2017/10/25 09:12:08 (GMT -400)
  config file = /home/rteague/git/clusters/aws-c1/ansible.cfg
  configured module search path = [u'/home/rteague/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /home/rteague/git/clusters/aws-c2/ansible/lib/ansible
  executable location = /home/rteague/git/clusters/aws-c2/ansible/bin/ansible
  python version = 2.7.13 (default, Sep  5 2017, 08:53:59) [GCC 7.1.1 20170622 (Red Hat 7.1.1-3)]
"><pre class="notranslate"><code class="notranslate">ansible 2.5.0 (devel ca115b0a8e) last updated 2017/10/25 09:12:08 (GMT -400)
  config file = /home/rteague/git/clusters/aws-c1/ansible.cfg
  configured module search path = [u'/home/rteague/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /home/rteague/git/clusters/aws-c2/ansible/lib/ansible
  executable location = /home/rteague/git/clusters/aws-c2/ansible/bin/ansible
  python version = 2.7.13 (default, Sep  5 2017, 08:53:59) [GCC 7.1.1 20170622 (Red Hat 7.1.1-3)]

</code></pre></div>
<h5 dir="auto">CONFIGURATION</h5>

<p dir="auto">N/A</p>
<h5 dir="auto">OS / ENVIRONMENT</h5>

<p dir="auto">N/A</p>
<h5 dir="auto">SUMMARY</h5>

<p dir="auto">When using the <code class="notranslate">pause</code> module, the execution of the playbook will hang if running the playbook as a background process.</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="# test.yml
---
- name: Test Playbook
  hosts: localhost
  connection: local
  gather_facts: false

  tasks:
  - pause:
      seconds: 2"><pre class="notranslate"><span class="pl-c"><span class="pl-c">#</span> test.yml</span>
---
- <span class="pl-ent">name</span>: <span class="pl-s">Test Playbook</span>
  <span class="pl-ent">hosts</span>: <span class="pl-s">localhost</span>
  <span class="pl-ent">connection</span>: <span class="pl-s">local</span>
  <span class="pl-ent">gather_facts</span>: <span class="pl-c1">false</span>

  <span class="pl-ent">tasks</span>:
  - <span class="pl-ent">pause</span>:
      <span class="pl-ent">seconds</span>: <span class="pl-c1">2</span></pre></div>

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

<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ ansible-playbook -i localhost, test.yml &gt; ansible-test.log &amp;
[1] 31739
                                                                                                                                    
[1]  + 31739 done       ansible-playbook -i localhost, test.yml &gt; ansible-test.log"><pre class="notranslate"><code class="notranslate">$ ansible-playbook -i localhost, test.yml &gt; ansible-test.log &amp;
[1] 31739
                                                                                                                                    
[1]  + 31739 done       ansible-playbook -i localhost, test.yml &gt; ansible-test.log
</code></pre></div>
<h5 dir="auto">ACTUAL RESULTS</h5>


<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ ansible-playbook -i localhost, test.yml &gt; ansible-test.log &amp;
[1] 19407

[1]  + 19407 suspended (tty output)  ansible-playbook -i localhost, test.yml &gt; ansible-test.log
$ tail ansible-test.log

PLAY [Test Playbook] ***************************************************************************************************************

TASK [pause] ***********************************************************************************************************************
Wednesday 25 October 2017  09:06:09 -0400 (0:00:00.062)       0:00:00.062 *****
Pausing for 2 seconds
(ctrl+C then 'C' = continue early, ctrl+C then 'A' = abort)

$ jobs
[1]  + suspended (tty output)  ansible-playbook -i localhost, test.yml &gt; ansible-test.log


$ fg
[1]  + 19407 continued  ansible-playbook -i localhost, test.yml &gt; ansible-test.log

$ tail ansible-test.log
(ctrl+C then 'C' = continue early, ctrl+C then 'A' = abort)
ok: [localhost]

PLAY RECAP *************************************************************************************************************************
localhost                  : ok=1    changed=0    unreachable=0    failed=0

Wednesday 25 October 2017  09:08:11 -0400 (0:02:01.558)       0:02:01.620 *****
===============================================================================
pause --------------------------------------------------------------------------------------------------------------------- 121.56s
Playbook run took 0 days, 0 hours, 2 minutes, 1 seconds
"><pre class="notranslate"><code class="notranslate">$ ansible-playbook -i localhost, test.yml &gt; ansible-test.log &amp;
[1] 19407

[1]  + 19407 suspended (tty output)  ansible-playbook -i localhost, test.yml &gt; ansible-test.log
$ tail ansible-test.log

PLAY [Test Playbook] ***************************************************************************************************************

TASK [pause] ***********************************************************************************************************************
Wednesday 25 October 2017  09:06:09 -0400 (0:00:00.062)       0:00:00.062 *****
Pausing for 2 seconds
(ctrl+C then 'C' = continue early, ctrl+C then 'A' = abort)

$ jobs
[1]  + suspended (tty output)  ansible-playbook -i localhost, test.yml &gt; ansible-test.log


$ fg
[1]  + 19407 continued  ansible-playbook -i localhost, test.yml &gt; ansible-test.log

$ tail ansible-test.log
(ctrl+C then 'C' = continue early, ctrl+C then 'A' = abort)
ok: [localhost]

PLAY RECAP *************************************************************************************************************************
localhost                  : ok=1    changed=0    unreachable=0    failed=0

Wednesday 25 October 2017  09:08:11 -0400 (0:02:01.558)       0:02:01.620 *****
===============================================================================
pause --------------------------------------------------------------------------------------------------------------------- 121.56s
Playbook run took 0 days, 0 hours, 2 minutes, 1 seconds

</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">copy module</p>
<h5 dir="auto">ANSIBLE VERSION</h5>

<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ansible 2.4.2.0
  config file = /opt/ansible/local/ansible.cfg
  configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /bin/ansible
  python version = 2.7.5 (default, Aug  4 2017, 00:39:18) [GCC 4.8.5 20150623 (Red Hat 4.8.5-16)]"><pre class="notranslate"><code class="notranslate">ansible 2.4.2.0
  config file = /opt/ansible/local/ansible.cfg
  configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /bin/ansible
  python version = 2.7.5 (default, Aug  4 2017, 00:39:18) [GCC 4.8.5 20150623 (Red Hat 4.8.5-16)]
</code></pre></div>
<h5 dir="auto">CONFIGURATION</h5>

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

<p dir="auto">CentOS Linux release 7.4.1708 (Core)</p>
<h5 dir="auto">SUMMARY</h5>
<p dir="auto">A copy task using <code class="notranslate">with_items</code> to copy both files and directories (recursively) to a given dest is causing the directory to be nested "within itself" somehow.</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="- name: copy a file and directory (with contents)
  copy:
    src: &quot;{{ item }}&quot;
    dest: &quot;/tmp/{{ item }}&quot;
  with_items:
    - testfile
    - testdir"><pre class="notranslate">- <span class="pl-ent">name</span>: <span class="pl-s">copy a file and directory (with contents)</span>
  <span class="pl-ent">copy</span>:
    <span class="pl-ent">src</span>: <span class="pl-s"><span class="pl-pds">"</span>{{ item }}<span class="pl-pds">"</span></span>
    <span class="pl-ent">dest</span>: <span class="pl-s"><span class="pl-pds">"</span>/tmp/{{ item }}<span class="pl-pds">"</span></span>
  <span class="pl-ent">with_items</span>:
    - <span class="pl-s">testfile</span>
    - <span class="pl-s">testdir</span></pre></div>

<h5 dir="auto">EXPECTED RESULTS</h5>
<p dir="auto">Both <code class="notranslate">testfile</code> and <code class="notranslate">testdir</code> should be copied to the dest path. Contents of the directory should be copied recursively.</p>
<h5 dir="auto">ACTUAL RESULTS</h5>

<p dir="auto"><code class="notranslate">testfile</code> gets copied OK. <code class="notranslate">testdir</code> gets copied to the destination as <code class="notranslate">testdir/testdir</code>.</p>

<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="# tree /tmp
/tmp
├── testdir
│   └── testdir
│       └── testfile2
└── testfile"><pre class="notranslate"><code class="notranslate"># tree /tmp
/tmp
├── testdir
│   └── testdir
│       └── testfile2
└── testfile
</code></pre></div>
<p dir="auto">Output of verbose log of the directory copy:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="changed: [XXX] =&gt; (item=testdir) =&gt; {
    &quot;changed&quot;: true,
    &quot;checksum&quot;: &quot;6d5bed3c88d0350e17b0049cc4e6d54445572e8c&quot;,
    &quot;dest&quot;: &quot;/tmp/testdir/testdir/testfile2&quot;,
    &quot;diff&quot;: [],
    &quot;gid&quot;: 0,
    &quot;group&quot;: &quot;root&quot;,
    &quot;invocation&quot;: {
        &quot;module_args&quot;: {
            &quot;attributes&quot;: null,
            &quot;backup&quot;: false,
            &quot;content&quot;: null,
            &quot;delimiter&quot;: null,
            &quot;dest&quot;: &quot;/tmp/testdir/testdir/testfile2&quot;,
            &quot;directory_mode&quot;: null,
            &quot;follow&quot;: false,
            &quot;force&quot;: true,
            &quot;group&quot;: null,
            &quot;local_follow&quot;: null,
            &quot;mode&quot;: null,
            &quot;original_basename&quot;: &quot;testdir/testfile2&quot;,
            &quot;owner&quot;: null,
            &quot;regexp&quot;: null,
            &quot;remote_src&quot;: null,
            &quot;selevel&quot;: null,
            &quot;serole&quot;: null,
            &quot;setype&quot;: null,
            &quot;seuser&quot;: null,
            &quot;src&quot;: &quot;/root/.ansible/tmp/ansible-tmp-1519257514.0-81246969639144/source&quot;,
            &quot;unsafe_writes&quot;: null,
            &quot;validate&quot;: null
        }
    },
    &quot;item&quot;: &quot;testdir&quot;,
    &quot;md5sum&quot;: &quot;f38f27da8d7262b45996a2d5193f1e25&quot;,
    &quot;mode&quot;: &quot;0644&quot;,
    &quot;owner&quot;: &quot;root&quot;,
    &quot;secontext&quot;: &quot;unconfined_u:object_r:admin_home_t:s0&quot;,
    &quot;size&quot;: 910,
    &quot;src&quot;: &quot;/root/.ansible/tmp/ansible-tmp-1519257514.0-81246969639144/source&quot;,
    &quot;state&quot;: &quot;file&quot;,
    &quot;uid&quot;: 0
}"><pre class="notranslate"><code class="notranslate">changed: [XXX] =&gt; (item=testdir) =&gt; {
    "changed": true,
    "checksum": "6d5bed3c88d0350e17b0049cc4e6d54445572e8c",
    "dest": "/tmp/testdir/testdir/testfile2",
    "diff": [],
    "gid": 0,
    "group": "root",
    "invocation": {
        "module_args": {
            "attributes": null,
            "backup": false,
            "content": null,
            "delimiter": null,
            "dest": "/tmp/testdir/testdir/testfile2",
            "directory_mode": null,
            "follow": false,
            "force": true,
            "group": null,
            "local_follow": null,
            "mode": null,
            "original_basename": "testdir/testfile2",
            "owner": null,
            "regexp": null,
            "remote_src": null,
            "selevel": null,
            "serole": null,
            "setype": null,
            "seuser": null,
            "src": "/root/.ansible/tmp/ansible-tmp-1519257514.0-81246969639144/source",
            "unsafe_writes": null,
            "validate": null
        }
    },
    "item": "testdir",
    "md5sum": "f38f27da8d7262b45996a2d5193f1e25",
    "mode": "0644",
    "owner": "root",
    "secontext": "unconfined_u:object_r:admin_home_t:s0",
    "size": 910,
    "src": "/root/.ansible/tmp/ansible-tmp-1519257514.0-81246969639144/source",
    "state": "file",
    "uid": 0
}
</code></pre></div>
<p dir="auto">In the above output, <code class="notranslate">original_basename</code> looks correct; however, <code class="notranslate">dest</code> seems malformed.</p>