My first thought was to put those two tasks into a block, modify task 1 to register a new variable that contains the current site
and use it in task 2. Then I remembered that you cannot loop over a block (currently…
https://github.com/ansible/ansible/issues/13262).
You could try to create a new list variable out of your dict which only contains all {{ site from dict }} and then use
with_nested. E.g.
- name: 'create docroot'
...
- name: 'extract sites'
set_fact: sitenames='{{ sitenames | default([]) }} + {{
item.name }}'
with_dict: '{{ sites }}'
- name: 'create symlinks'
file:
dest: '/var/www/html/{{ item[0] }}/{{ item[1] }}'
src: '/var/www/grav/grav/{{ item[1] }}'
state: link
owner: www-data
group: www-data
with_nested:
- '{{ sitenames }}'
- [ 'bin', 'CHANGELOG.md', ...]
> >
ansible-proje...@googlegroups.com <mailto:
ansible-project%2Bunsu...@googlegroups.com>
> <mailto:
ansible-proje...@googlegroups.com <mailto:
ansible-project%2Bunsu...@googlegroups.com>>.
> > To post to this group, send email to
ansible...@googlegroups.com <mailto:
ansible...@googlegroups.com>
> <mailto:
ansible...@googlegroups.com <mailto:
ansible...@googlegroups.com>>.
> <
https://groups.google.com/d/msgid/ansible-project/13eb2739-7e21-4503-8e75-7f3db8803966%40googlegroups.com?utm_medium=email&utm_source=footer
> <
https://groups.google.com/d/msgid/ansible-project/13eb2739-7e21-4503-8e75-7f3db8803966%40googlegroups.com?utm_medium=email&utm_source=footer>>.
> > For more options, visit
https://groups.google.com/d/optout <
https://groups.google.com/d/optout>.
> <
https://groups.google.com/d/topic/ansible-project/gns-XRtt9aE/unsubscribe>.
> To unsubscribe from this group and all its topics, send an email to
ansible-proje...@googlegroups.com
> <mailto:
ansible-project%2Bunsu...@googlegroups.com>.
> To post to this group, send email to
ansible...@googlegroups.com <mailto:
ansible...@googlegroups.com>.
> To view this discussion on the web visit
>
https://groups.google.com/d/msgid/ansible-project/d8d85ea0-addc-6d99-c3ad-be9bfc62f83d%40gmail.com
> <
https://groups.google.com/d/msgid/ansible-project/d8d85ea0-addc-6d99-c3ad-be9bfc62f83d%40gmail.com>.
> For more options, visit
https://groups.google.com/d/optout <
https://groups.google.com/d/optout>.
>
>
> --
> 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-proje...@googlegroups.com
> <mailto:
ansible-proje...@googlegroups.com>.
> To post to this group, send email to
ansible...@googlegroups.com <mailto:
ansible...@googlegroups.com>.
> To view this discussion on the web visit
>
https://groups.google.com/d/msgid/ansible-project/CAPJTyAXqsGF7HMoF5fNjaacL%2Bfsxz%3D9dZ%3DhHR6K7THF%2B74QhTg%40mail.gmail.com
> <
https://groups.google.com/d/msgid/ansible-project/CAPJTyAXqsGF7HMoF5fNjaacL%2Bfsxz%3D9dZ%3DhHR6K7THF%2B74QhTg%40mail.gmail.com?utm_medium=email&utm_source=footer>.