Kevin, That sounds really useful. I am not aware of any simple way to do that, but I am following this conversation because I might learn something useful.
Thanks for asking! Joanna On Wednesday, June 29, 2016 at 1:48:25 PM UTC-5, Kevin Schumacher wrote: > > Hi all, > > I am looking for a way to list all variables referenced by a playbook > without executing any tasks. Ideally, I would also be able to spit out the > values of those variables for each host matched in the play. > > My use case for this is for when I inherit a complex playbook or role from > a colleague that is not well documented. > > I know that I can do this: > ansible -m debug -a "var=hostvars[inventory_hostname]" > to spit out the variables set for each host in inventory. This works fine, > but lists every variable defined for those hosts. > > I'm only interested in the variables that are used by a given playbook or > role. Is there a built-in way to do this? > > I know, of course, that I could just read through the playbook/role to > pick out the variables, maybe there will be a defaults/main.yml, etc. I > also know that I could just execute the playbook and wait until it > complains about a missing value. But I'd love a one-stop solution showing > me what variables are expected (and, ideally, their values when given an > inventory). > > If there's not a built-in way to do all of this, is there another built-in > way to get part of the way there? > > We're on Ansible 1.9.4 still, but will be moving to Ansible 2 soon, so > help on either is appreciated. > > Thanks, > Kevin > -- 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/b0818c41-7bda-46ca-85f5-376ed298a269%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
