Puppet Nodes.pp包含模块执行顺序

Mav*_*ick 5 provisioning puppet

我正在尝试为某些节点设置某些模块的顺序.

node basenode{
 include ps
 include netfx
 include hg
 include reportviewer2012
 include wdeploy30
 include sqlexpress2008
 include windowsrolesfeatures
 include tcbase
}

node 'myserver' inherits basenode  {
 include tcuiagent

 Class['tcuiagent'] -> Class['tcbase'] -> Class['windowsrolesfeatures'] -> Class['ps']
}
Run Code Online (Sandbox Code Playgroud)

当然,我不想在模块资源中设置依赖项,因为这会使它们相互依赖,而我不想这样做.在这种情况下,我想完成这个订单.

  1. ps(第一个)
  2. windowsrolesfeatures
  3. anyotherpackage {hg,netfx ...}(不关心配置顺序)n.tcbase
  4. tcuigant(最后一个)

Off*_*rmo 1

如果您确实不想表达模块之间的关系,可以使用阶段来强制执行顺序。

您必须首先在顶部清单中声明阶段:

## Very important : we define stages.
## Can only be done here.
stage { 'first': }      # the first of first
stage { 'apt': }        # to install apt sources and run apt-get update if necessary
# stage main            # default stage, always available
stage { 'last': }       # a stage after all the others
# Now we define the order :
Stage[first] -> Stage[apt] -> Stage[main] -> Stage[last]
Run Code Online (Sandbox Code Playgroud)

然后使用它们:

# basics needing a run state
# We use the "class" syntax here because we need to specify a run stage.
class
{
   'puppeted': # debug
      stage   => first, # note the explicit stage !
      ;
   'apt_powered': # Very important for managing apt sources
      stage   => apt, # note the explicit stage !
      #offline => 'true', # uncomment this if you are offline or don't want updates
      ;
   'apt_powered::upgraded': # will systematically upgrade paquets. dev machine -> we want to stay up to date
      stage   => apt, # note the explicit stage !
      ;
}
Run Code Online (Sandbox Code Playgroud)

但这很丑陋,而且这不是舞台的用途。