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

On Thursday, 11 February 2016 10:19:56 UTC, Mark Matthews wrote:
>
> 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 
>> only added the last line.
>>
>> ---
>> - name: Add host file entries
>>   hosts: all
>>   tasks:
>>     - name: Check if line is present in config
>>       win_lineinfile:
>>         dest: C:\Windows\System32\drivers\etc\hosts
>>         line: "x.x.x.x   www.website1.com"
>>         line: "x.x.x.x   www.website2.com"
>>         line: "x.x.x.x   www.website3.com"
>>         line: "x.x.x.x   www.website4.com"
>>
>>
>> Is there a way of doing this?
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/89966da8-e4f7-4372-923f-9b1f70fc453b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to