Builder variables; are they published anywhere?

17 views
Skip to first unread message

Justin DynamicD

unread,
Feb 13, 2019, 4:36:45 PM2/13/19
to Packer
So when going down the provisioning steps, it's pretty common to use the variable {{.WinRMPassword}} when provisioning Windows servers, and you can also call variables such as {{.Path}} and the like ...

... but is there a place somewhere that all these variables are documented?  The root of this question comes down to templates that build in multiple cloud providers.  These providers will actually use different usernames and passwords for the connection (AWS defaults to "Administrator" whereas Azure uses "Packer", each of course with it's own username).  So if I need to run a custom process that uses information like username/password ... it's good to know I can reliably get it (especially as it's temporary info).  Yet while {{.WinRMPassword}} works ... {{.WinRMUserName}} doesn't. So I'm left to guessing these values.

Does anyone know where I can find a definitive list of vars the various builders make available?  If so, I can tell what my capabilities actually are.  I'm not very good at reading Go unfortunately, so asking me to crawl the source code doesn't help unless you can tell me _where_ that is.  (Yes I hate that language with a passion, but that's another thread).

Regards,
Justin DynamicD

Megan Marsh

unread,
Feb 13, 2019, 4:48:33 PM2/13/19
to packe...@googlegroups.com
Generally these template variables are documented in provisioners and builders within the options that are allowed to use them. For example, https://www.packer.io/docs/provisioners/powershell.html#environment_vars talks about how you can use WinRMPassword.

The variables are scattered all over the source so it's not like that would help you anyway.

If it's not in the documentation for a given builder or provisioner option, you probably can't use it in that option.
Reply all
Reply to author
Forward
0 new messages