Hi

You probably want to use with_items here and the syntax would look 
something like

- win_copy:
    src: files/index.html
    dest: '{{ ansible_iis_root }}\{{ item }}\index.html'
  with_items:
  - site 1
  - site 2

What this means is that the win_copy task will copy the file in 
files/index.html to 2 different locations, e.g. if we consider 
ansible_iis_root to be C:\wwwroot then the above task will copy it to

   - C:\wwwroot\site 1\index.html
   - C:\wwwroot\site 2\index.html

What that syntax means is that it will run that task for each item/string 
that you define and substitute the variable {{ item }} with the current 
loop value. You can define the list beforehand as a variable and set 
*with_items: 
'{{ iis_sites }}' *if you want to drive it through config.


One thing to note, I would avoid using double quote when setting Windows 
paths, if you don't use quotes or just a single quote, you don't need to 
escape the backslashes which is easier to write.

Thanks

Jordan

-- 
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/2066b81e-3f94-4fc4-94e4-8f0d740a8682%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to