【原创】puppet模板变量引用规则

翻译自learningpuppet

1、Facts, global variables, and local variables from the current scope are available to a template as  Ruby instance variables — instead of Puppetʼs $ prefix, they have an @ prefix. (e.g. @fqdn,@memoryfree, @operatingsystem, etc.) 

     fact,全局变量和来自当前域的局部变量对于一个模板来说可用,但是作为ruby实例变量来说,他们用@前缀代替puppet的$。比如说(@fqdn,@memoryfree,@operatingsystem等)

2、Variables from other scopes can be accessed with the scope.lookupvar method, which takes a  long variable name without the $ prefix. (For example, scope.lookupvar('apache::user').) 

     对于其他作用域的变量,能够通过scope.lookupvar方法访问,这种方法不用$引用一个长变量名。(比如,scope.lookupvar('apache::user'))

posted @ 2017-02-21 16:06  puremans  阅读(1056)  评论(0编辑  收藏  举报