<h5 dir="auto">ISSUE TYPE</h5>
<ul dir="auto">
<li>Bug Report</li>
</ul>
<h5 dir="auto">COMPONENT NAME</h5>
<p dir="auto">template 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.2.1.0
  config file =
  configured module search path = Default w/o overrides"><pre class="notranslate"><code class="notranslate">ansible 2.2.1.0
  config file =
  configured module search path = Default w/o overrides
</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">Cannot apply a <code class="notranslate">to_nice_yaml</code> filter to a list of ip address. Note that this same playbook works well on ansible 2.2.0.0</p>
<h5 dir="auto">STEPS TO REPRODUCE</h5>
<p dir="auto">template.j2</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="subnets:
  {{ subnets | to_nice_yaml }}"><pre class="notranslate"><code class="notranslate">subnets:
  {{ subnets | to_nice_yaml }}
</code></pre></div>
<p dir="auto">test.yaml</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="---
  - hosts: localhost
    connection: local
    vars:
      subnets: &quot;{{ [(ansible_default_ipv4.network + '/' + ansible_default_ipv4.netmask) | ipaddr] }}&quot;
    tasks:
      - name: Create config
        template:
          src: template.j2
          dest: ./config"><pre class="notranslate"><code class="notranslate">---
  - hosts: localhost
    connection: local
    vars:
      subnets: "{{ [(ansible_default_ipv4.network + '/' + ansible_default_ipv4.netmask) | ipaddr] }}"
    tasks:
      - name: Create config
        template:
          src: template.j2
          dest: ./config
</code></pre></div>
<h1 dir="auto">ansible-playbook test.yaml</h1>
<h5 dir="auto">EXPECTED RESULTS</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="TASK [Create config] ***********************************************************
changed: [localhost] =&gt; {&quot;changed&quot;: true, &quot;checksum&quot;: &quot;50a3b2ac0572ebc8e4fe03a7f40bfabcd222d63c&quot;, &quot;dest&quot;: &quot;./config&quot;, &quot;gid&quot;: 20, &quot;group&quot;: &quot;staff&quot;, &quot;md5sum&quot;: &quot;d89ea9ad98dadabf94e53226657c21f8&quot;, &quot;mode&quot;: &quot;0644&quot;, &quot;owner&quot;: &quot;albertom&quot;, &quot;size&quot;: 28, &quot;src&quot;: &quot;/Users/albertom/.ansible/tmp/ansible-tmp-1484951820.46-246530977738450/source&quot;, &quot;state&quot;: &quot;file&quot;, &quot;uid&quot;: 502}"><pre class="notranslate"><code class="notranslate">TASK [Create config] ***********************************************************
changed: [localhost] =&gt; {"changed": true, "checksum": "50a3b2ac0572ebc8e4fe03a7f40bfabcd222d63c", "dest": "./config", "gid": 20, "group": "staff", "md5sum": "d89ea9ad98dadabf94e53226657c21f8", "mode": "0644", "owner": "albertom", "size": 28, "src": "/Users/albertom/.ansible/tmp/ansible-tmp-1484951820.46-246530977738450/source", "state": "file", "uid": 502}
</code></pre></div>
<h5 dir="auto">ACTUAL RESULTS</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="TASK [Create config] ***********************************************************
fatal: [localhost]: FAILED! =&gt; {&quot;changed&quot;: false, &quot;failed&quot;: true, &quot;msg&quot;: &quot;RepresenterError: cannot represent an object: 192.168.1.20/24&quot;}
	to retry, use: --limit @/Users/albertom/github/template/test.retry"><pre class="notranslate"><code class="notranslate">TASK [Create config] ***********************************************************
fatal: [localhost]: FAILED! =&gt; {"changed": false, "failed": true, "msg": "RepresenterError: cannot represent an object: 192.168.1.20/24"}
	to retry, use: --limit @/Users/albertom/github/template/test.retry
</code></pre></div>
<h3 dir="auto">Issue Type:</h3>
<p dir="auto">Bug Report</p>
<h3 dir="auto">Ansible Version:</h3>
<p dir="auto">ansible 1.8.2</p>
<h3 dir="auto">Environment:</h3>
<ul dir="auto">
<li>OS X 10.10.2</li>
<li>VMWare Fusion Professional 7.1.1</li>
<li>Vagrant 1.7.2</li>
<li>vagrant-vmware-fusion (3.2.3)</li>
</ul>
<h3 dir="auto">Summary:</h3>
<p dir="auto">When running a template-task on a vagrant shared folder, the playbook-run is stopped with the error</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="failed: [default] =&gt; {&quot;failed&quot;: true, &quot;parsed&quot;: false}
SUDO-SUCCESS-fkqfzpqnukvypcybwjzcuueirjhhaorz
Traceback (most recent call last):
  File &quot;/home/vagrant/.ansible/tmp/ansible-tmp-1424374956.05-84759286783521/copy&quot;, line 1824, in &lt;module&gt;
    main()
  File &quot;/home/vagrant/.ansible/tmp/ansible-tmp-1424374956.05-84759286783521/copy&quot;, line 238, in main
    module.atomic_move(src, dest)
  File &quot;/home/vagrant/.ansible/tmp/ansible-tmp-1424374956.05-84759286783521/copy&quot;, line 1624, in atomic_move
    os.chown(dest, os.getuid(), os.getgid())
OSError: [Errno 1] Operation not permitted: '/vagrant/test.conf'
Exception OSError: (2, 'No such file or directory', '/vagrant/.ansible_tmpPHJWkgtest.conf') in &lt;bound method _TemporaryFileWrapper.__del__ of &lt;closed file '&lt;fdopen&gt;', mode 'w+b' at 0x7fc206235270&gt;&gt; ignored"><pre class="notranslate"><code class="notranslate">failed: [default] =&gt; {"failed": true, "parsed": false}
SUDO-SUCCESS-fkqfzpqnukvypcybwjzcuueirjhhaorz
Traceback (most recent call last):
  File "/home/vagrant/.ansible/tmp/ansible-tmp-1424374956.05-84759286783521/copy", line 1824, in &lt;module&gt;
    main()
  File "/home/vagrant/.ansible/tmp/ansible-tmp-1424374956.05-84759286783521/copy", line 238, in main
    module.atomic_move(src, dest)
  File "/home/vagrant/.ansible/tmp/ansible-tmp-1424374956.05-84759286783521/copy", line 1624, in atomic_move
    os.chown(dest, os.getuid(), os.getgid())
OSError: [Errno 1] Operation not permitted: '/vagrant/test.conf'
Exception OSError: (2, 'No such file or directory', '/vagrant/.ansible_tmpPHJWkgtest.conf') in &lt;bound method _TemporaryFileWrapper.__del__ of &lt;closed file '&lt;fdopen&gt;', mode 'w+b' at 0x7fc206235270&gt;&gt; ignored
</code></pre></div>
<p dir="auto">The file is generated and on subsequent runs (also when changing it) no error occurs. I created a sample repository that showcases the error by erasing the file after creating it, so every <code class="notranslate">vagrant provision</code> run leads to the error.</p>
<h3 dir="auto">Steps To Reproduce:</h3>
<ol dir="auto">
<li>Clone my sample repo <a href="https://github.com/timbuchwaldt/vagrant-ansible-bug">https://github.com/timbuchwaldt/vagrant-ansible-bug</a></li>
<li>Run <code class="notranslate">vagrant up</code></li>
</ol>
<h3 dir="auto">Expected Results:</h3>
<p dir="auto">The file is created without an error</p>
<h3 dir="auto">Actual Results:</h3>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="failed: [default] =&gt; {&quot;failed&quot;: true, &quot;parsed&quot;: false}
SUDO-SUCCESS-fkqfzpqnukvypcybwjzcuueirjhhaorz
Traceback (most recent call last):
  File &quot;/home/vagrant/.ansible/tmp/ansible-tmp-1424374956.05-84759286783521/copy&quot;, line 1824, in &lt;module&gt;
    main()
  File &quot;/home/vagrant/.ansible/tmp/ansible-tmp-1424374956.05-84759286783521/copy&quot;, line 238, in main
    module.atomic_move(src, dest)
  File &quot;/home/vagrant/.ansible/tmp/ansible-tmp-1424374956.05-84759286783521/copy&quot;, line 1624, in atomic_move
    os.chown(dest, os.getuid(), os.getgid())
OSError: [Errno 1] Operation not permitted: '/vagrant/test.conf'
Exception OSError: (2, 'No such file or directory', '/vagrant/.ansible_tmpPHJWkgtest.conf') in &lt;bound method _TemporaryFileWrapper.__del__ of &lt;closed file '&lt;fdopen&gt;', mode 'w+b' at 0x7fc206235270&gt;&gt; ignored"><pre class="notranslate"><code class="notranslate">failed: [default] =&gt; {"failed": true, "parsed": false}
SUDO-SUCCESS-fkqfzpqnukvypcybwjzcuueirjhhaorz
Traceback (most recent call last):
  File "/home/vagrant/.ansible/tmp/ansible-tmp-1424374956.05-84759286783521/copy", line 1824, in &lt;module&gt;
    main()
  File "/home/vagrant/.ansible/tmp/ansible-tmp-1424374956.05-84759286783521/copy", line 238, in main
    module.atomic_move(src, dest)
  File "/home/vagrant/.ansible/tmp/ansible-tmp-1424374956.05-84759286783521/copy", line 1624, in atomic_move
    os.chown(dest, os.getuid(), os.getgid())
OSError: [Errno 1] Operation not permitted: '/vagrant/test.conf'
Exception OSError: (2, 'No such file or directory', '/vagrant/.ansible_tmpPHJWkgtest.conf') in &lt;bound method _TemporaryFileWrapper.__del__ of &lt;closed file '&lt;fdopen&gt;', mode 'w+b' at 0x7fc206235270&gt;&gt; ignored
</code></pre></div>