Passing variables for "with_subelements" in a play

Hi,

Seems like I am running in circles trying to setup “universal” plays.

I have nginx role that is setting up server blocks according to defined users.

  • name: add default site template
    template: src=default.conf.j2 dest=/etc/nginx/sites-available/{{ item.1 }}.conf
    notify: restart nginx
    with_subelements:
  • users
  • webdir

Here are vars:

users:

Is it possibile to pass this kind of a list in a playbook?

  • {role: ansible_nginx, tags: nginx, users: - user: webdir: /var/www}

Obviously this is just example that does not work. But I cant figure if it is possibilie.

  • {role: ansible_nginx, tags: nginx, users: - user: webdir: /var/www}

Try running this through yamllint.com and you’ll see this isn’t quite valid YAML, which is the problem.

Thanks that solved it. :slight_smile: