Adding Multiple lines to file

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 only added the last line.

You would probably want to loop over a list of “lines” using with_items, and them just use “{{ item }}” for the “line” argument.

Hi Matt

How exactly would that look like in a playbook?

Cheers
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 helps,

Jon

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.