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/35d2fb16-2c82-4abd-8a10-a1314fd7b859%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to