Complex loops?

22 views
Skip to first unread message

Nico K.

unread,
Aug 25, 2015, 8:00:20 AM8/25/15
to Ansible Project
Hi,

Given the following structure:

roles/bugzilla/vars/main.yml:

bugzilla:
  vhost:
    name: x
    stuff: c

roles/subversion/vars/main.yml:
   
subversion:
  vhost:
   name: y
    stuff: d

I'm trying to do the following

playbook.yml:

- name: x
  ...
   roles:
     - { role: apache, vhosts: [ 'subversion', 'bugzilla' ] }

roles/apache/tasks/main.yml:

- name: render vhosts
  template:
     src: {{ item['vhost']['name'] }}.conf
     ..
   with_items:
      - vhosts

I would expect that the with_items loops evaluated 'vhosts' to subversion and bugzilla and in term give me access to the underlying structure of those variables, thus bugzilla.vhost.name etc. however I can't seem to get this to work.
What am I doing wrong here? Or is this simply not supported?

Thanks,
Nico
Reply all
Reply to author
Forward
0 new messages