If you really mean passing parameters to roles:

roles:
   # short form
   - webserver
   # long form
   - { role: dbserver, port: 4200, foo: [ 1,2,3] }

vars_files of course works too, I'd need to see your vars_file to see
what you might have wrong in it.



On Sat, Mar 22, 2014 at 2:21 AM, Adam Bozanich <[email protected]> wrote:

> I'm having trouble figuring out how to pass non-string parameters to roles.
>
> I've tried a few different methods, with the most recent using
> "vars_files" in the play:
>
> https://github.com/boz/ansible-deploy/blob/multiplay/playbook.yml#L45
>
> This only seems to import the variables into the play; the variables
> defined in the vars file aren't visible in the roles.
>
> Ideally I'd be able to parametrize roles with a reference to a compound
> variable.  I've tried this, but the roles only receive a stringified
> version of the hash that I pass in.
>
> The only other options I can see at this point are either passing in a
> large amount of parameters every time or creating an extra role for every
> "abstract" role that I want to invoke.  Neither of these sound very
> appealing and so I'm hoping that there's something that I'm missing.  Ideas?
>
> Thanks,
> -Adam
>
> --
> 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/baee45cc-3069-473f-9c3d-6c993147aabb%40googlegroups.com<https://groups.google.com/d/msgid/ansible-project/baee45cc-3069-473f-9c3d-6c993147aabb%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit 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 [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/CAEVJ8QM6bwvKi0zcxV5bKTsa8HiGk2DHsL3CvxiMT3YS7P5vdg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to