I've been looking for a solutions for this, but I can't seem to figure it 
out. Here is what I want to do:

I'm writing a playbook to manage a number of DNS servers. I have a list of 
zones in my vars file, like so:

list_of_zones:
  - a.com
  - b.com
  - c.com
etc...

I then have a dir with each zone file in it:

zones/a.com.db
zones/b.com.db
etc...

However, for some of the zones, I just want to use a default zone file. So 
basically, what I would like to do is something like this:

- name: Copy zone files
  copy: src=zones/{{ item }} dest=/var/named/zones/{{ item }}
  with_first_file:
    - path/to/zones/{{ item }}.db
    - path/to/zones/default.db
  with_items:
    - list_of_zones

This however does not work.

I tried to split out the copy part and with_first_file to a different file 
in the playbook and include it, passing the zone as a var, but I then got a 
warning that using with_items together with include was not recommended and 
that it was going to be deprecated.

I'm a bit lost how to solve this. One option would of course be to extend 
my zones var to include the name of the zone file as well, but I would like 
to make this as dynamic as possible. Any ideas are welcome.

Thanks,
/Martin

-- 
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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to