Hi folks,
Maybe there is no solution for that exactly. I want to make a role that is
completly free from looping over a list of complex map like so:
# group_vars/python-app/apps.yml
-python_apps:
- name: foo
uno: 1
dos: 2
[...]
- name: bar
uno: 1000
dos: 2000
[...]
# roles/python-apps/tasks/main.yml
- include: install.yml
with_items: "{{python_apps}}"
tags:
- python-apps
- install
# roles/python-apps/tasks/install.yml
- debug: var={{item.name}}
The role itself is maintenable, but the group_vars file containing all
complex data structures will become huge and hard to maintain. What do you
do in this case?
Thanks !
Kindly
Le lundi 11 juillet 2016 16:18:28 UTC+2, Eric Bruno a écrit :
>
> Hi folks,
>
> I'm facing an issue with roles call in plays when passing complex var. I
> want to find a way to pass variable by reference like so:
>
> #group_vars/python-app/fooapi.yml
>
> fooapi:
> uno: 1
> dos: 2
>
>
> #group_vars/python-app/barapi.yml
>
> fooapi:
> uno: 1000
> dos: 2000
>
> #play.yml
>
> - hosts: python-app
> roles:
> - { role: python, app: fooapi}
> - { role: python, app: barapi}
>
> #roles/python/tasks/main.yml
>
> - debug: var=app
>
> This is maybe a bad practice but if we found a solution, this is a very
> usefull and nice way to do what I want to do.
>
> Thank you for your help :)
>
--
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.
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/343270da-5349-4296-839b-529988ada95f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.