Issue 1:
ISSUE TYPE

Bug Report

COMPONENT NAME

template module

ANSIBLE VERSION

ansible 2.2.1.0
config file =
configured module search path = Default w/o overrides

CONFIGURATION

N/A

OS / ENVIRONMENT

N/A

SUMMARY

Cannot apply a to_nice_yaml filter to a list of ip address. Note that this same playbook works well on ansible 2.2.0.0

STEPS TO REPRODUCE

template.j2

subnets:
{{ subnets | to_nice_yaml }}

test.yaml

---
- 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

ansible-playbook test.yaml

EXPECTED RESULTS

TASK [Create config] ***********************************************************
changed: [localhost] => {"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}

ACTUAL RESULTS

TASK [Create config] ***********************************************************
fatal: [localhost]: FAILED! => {"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

Issue 2:
Issue Type:

Bug Report

Ansible Version:

ansible 1.8.2

Environment:

OS X 10.10.2

VMWare Fusion Professional 7.1.1

Vagrant 1.7.2

vagrant-vmware-fusion (3.2.3)

Summary:

When running a template-task on a vagrant shared folder, the playbook-run is stopped with the error

failed: [default] => {"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 <module>
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 <bound method _TemporaryFileWrapper.__del__ of <closed file '<fdopen>', mode 'w+b' at 0x7fc206235270>> ignored

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 vagrant provision run leads to the error.

Steps To Reproduce:

Clone my sample repo https://github.com/timbuchwaldt/vagrant-ansible-bug

Run vagrant up

Expected Results:

The file is created without an error

Actual Results:

failed: [default] => {"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 <module>
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 <bound method _TemporaryFileWrapper.__del__ of <closed file '<fdopen>', mode 'w+b' at 0x7fc206235270>> ignored