Hi Jon
Thanks for the response.
I was actually able to find a work around. Not a great solution, so will
look at win_template.
---
- name: Add host file entries
hosts: all
tasks:
- name: Add host file entries
win_lineinfile:
dest: C:\Windows\System32\drivers\etc\hosts
Thanks Jon
I will take a look at the link and see if it can help me.
Cheers
On Thursday, February 11, 2016 at 10:34:55 AM UTC, Mark Matthews wrote:
>
> 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:
>
> -
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
Hope that helps,
Jon
On Thursday, 11 February 2016 10:34:55 UTC, Mark
Lots of examples of the various ways to loop
here: http://docs.ansible.com/ansible/playbooks_loops.html#standard-loops
Depending on what you are trying to achieve, you might actually find the
win_template module is easier to work with rather than multiple calls to
win_lineinfile
Hope this help
Hi Matt
How exactly would that look like in a playbook?
Cheers
Mark
On Wednesday, February 10, 2016 at 5:11:21 PM UTC, Mark Matthews wrote:
>
> Hi
>
> I want to add multiple lines to a host file on some Windows machines.
>
> I tried using win_lineinfile in the following playbook below...but it o