My intention is to pass it to the role not redefine it. What do you suggest?

On Friday, October 28, 2016 at 2:44:32 PM UTC-4, Kai Stian Olstad wrote:
>
> On 28. okt. 2016 18:56, Neil Watson wrote: 
> > Greetings, 
> > 
> > I'm trying to pass a data structure to a role, but it's not working out. 
> > What have I done wrong? 
> > 
> > main.yml: 
> > --- 
> > - hosts: localhost 
> >   vars: 
> >     image: 
> >       one: 
> >         state: present 
> >         path: /usr/src 
> >   roles: 
> >     - { role: test, image: "{{ image.one }}" } 
> > 
> > roles/test/tasks/main.yml: 
> > --- 
> >   - debug: 
> >       msg: "state: {{ image.state }}, path: {{ image.path }}" 
> > 
> > Expected results: 
> > 
> > debug: state: present, path: /usr/src 
>
> First you define image in the vars section, and then you overwrite image 
> with itself when you call the role, you can't do that. 
>
> -- 
> Kai Stian Olstad 
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/9817f2e8-2209-434b-b330-106101b274b7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to