How to pass node specific information to class in puppet?

泄露秘密 提交于 2019-12-24 18:23:42

问题


I want to pass node specific information to a class, which then could evaluate it for specific purposes. Actually this question consists of three parts.

Say, I have the following node:

node 'devbox' {
    $serverType = 'something'

    include someClass

    someOtherClass { 'someOtherClass': 
        par1 => 'value',     
    }

    targetClass { 'nodeInformationShouldGoHere': }
}

Inside targetClass, I want to evaluate if serverType, someClass or someOtherClass is set (e.g. with if-else). My questions now are:

  1. Is setting and passing the variable suitable in puppet for this?
  2. or should I use tags (as the classes are automatically tagged for this node)?
  3. Are their further approaches and what are limitations to above ones (e.g. do they work for resource types?)?

回答1:


You can absolutely use puppet this way. Read over the documentation for Parameterized Classes and see if that meets your needs.



来源:https://stackoverflow.com/questions/11229302/how-to-pass-node-specific-information-to-class-in-puppet

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!