# update /etc/hosts file

**URL:** <https://forum.ansible.com/t/update-etc-hosts-file/17551>\
**Category:** Ansible Project\
**Created:** [February 18, 2015, 2:46pm UTC](https://forum.ansible.com/t/update-etc-hosts-file/17551 "2015-02-18T14:46:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Diego\_Rucci](https://avatars.discourse-cdn.com/v4/letter/d/cc9497/32.png) [@Diego\_Rucci](https://forum.ansible.com/u/Diego_Rucci)\
**Post date:** [February 18, 2015, 2:46pm UTC](https://forum.ansible.com/t/update-etc-hosts-file/17551/1 "2015-02-18T14:46:57Z")

</div>

Hi, I’m just starting with ansible.  
I’m running a proxmox server with 12 containers.  
I made some playbooks that actually works (like setting tzdata and apt-update)

I was trying to automate etc/hosts file update. I’m using this playbook, taken from [here]([http://xmeblog.blogspot.com/2013/06/ansible-dynamicaly-update-et](http://xmeblog.blogspot.com/2013/06/ansible-dynamicaly-update-et) chosts.html):

`

---

<div class="post-metadata">

**Author:** ![Diego\_Rucci](https://avatars.discourse-cdn.com/v4/letter/d/cc9497/32.png) [@Diego\_Rucci](https://forum.ansible.com/u/Diego_Rucci)\
**Post date:** [February 18, 2015, 5:33pm UTC](https://forum.ansible.com/t/update-etc-hosts-file/17551/2 "2015-02-18T17:33:50Z")

</div>

Found it.  
It is an extra “space” at lineinfile:

` `… {{item}} " state=present` `  
should it be

` `… {{item}}" state=present` `
