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

On Wed, Feb 10, 2016 at 11:11 AM, Mark Matthews <[email protected]>
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/369620ad-7b20-44a6-80ba-c70f3573798f%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/369620ad-7b20-44a6-80ba-c70f3573798f%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Matt Martz
@sivel
sivel.net

-- 
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/CAD8N0v_ubsWMGDciW4iWpdSTpGY_qZMHYmE4HwgEJN1DKPEgxA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to