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 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: > > --- > - 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" > > > I have tried the following, but keep getting errors: > > --- > - name: Add host file entries > hosts: all > tasks: > - name: Add host file entries > blockinfile: > dest: C:\Windows\System32\drivers\etc\hosts > block: > 10.10.3.76 www.website1.com > 10.10.3.77 www.website1.com > 10.10.3.19 www.website1.com > 10.10.10.2 www.website1.com > 10.10.3.74 www.website1.com > > > Does anyone know of way that this can be done? > -- 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/84fa25c5-9c17-4f31-9289-3e360c6510f2%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
