# Adding Multiple Lines to file (Windows Servers)

**URL:** <https://forum.ansible.com/t/adding-multiple-lines-to-file-windows-servers/20534>\
**Category:** Ansible Project\
**Tags:** windows\
**Created:** [February 11, 2016, 10:34am UTC](https://forum.ansible.com/t/adding-multiple-lines-to-file-windows-servers/20534 "2016-02-11T10:34:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mark\_Matthews](https://avatars.discourse-cdn.com/v4/letter/m/5f9b8f/32.png) [@Mark\_Matthews](https://forum.ansible.com/u/Mark_Matthews)\
**Post date:** [February 11, 2016, 10:34am UTC](https://forum.ansible.com/t/adding-multiple-lines-to-file-windows-servers/20534/1 "2016-02-11T10:34:55Z")

</div>

Hi

I am trying to add multiple lines to the host file on some Windows servers.

If I use the following playbook I can add one line:

---

<div class="post-metadata">

**Author:** ![j.r.hawkesworth](https://avatars.discourse-cdn.com/v4/letter/j/a3d4f5/32.png) [@j.r.hawkesworth](https://forum.ansible.com/u/j.r.hawkesworth)\
**Post date:** [February 11, 2016, 11:38am UTC](https://forum.ansible.com/t/adding-multiple-lines-to-file-windows-servers/20534/2 "2016-02-11T11:38:51Z")

</div>

blockinfile is not a windows module unfortunately.

There is an as yet un merged module for manipulating the windows hosts file though - perhaps give that a try - [https://github.com/ansible/ansible-modules-extras/pull/1455](https://github.com/ansible/ansible-modules-extras/pull/1455)

Hope that helps,

Jon

---

<div class="post-metadata">

**Author:** ![Mark\_Matthews](https://avatars.discourse-cdn.com/v4/letter/m/5f9b8f/32.png) [@Mark\_Matthews](https://forum.ansible.com/u/Mark_Matthews)\
**Post date:** [February 11, 2016, 4:59pm UTC](https://forum.ansible.com/t/adding-multiple-lines-to-file-windows-servers/20534/3 "2016-02-11T16:59:15Z")

</div>

Thanks Jon

I will take a look at the link and see if it can help me.

Cheers
