在 puppet 中需要 rbenv::compile 语法

在 puppet 中需要 rbenv::compile 语法

我有以下代码:

  rbenv::compile { "1.9.3-p327":
    user => "vagrant",
    home => "/home/vagrant",
  }

  exec {"rbenv-global-1.9.3-p327":
    command => "rbenv global 1.9.3-p327",
    path => "/home/vagrant/.rbenv/bin",
  }

我想在“rbenv-global-1.9.3-p327”中添加一个要求,因为它应该在 rbenv::compile 之后执行,但我不知道正确的语法

答案1

如果你不知道正确的语法,为什么不去查一下呢?Puppet 文档非常棒,尤其是“学习 Puppet”部分。你想要关键字require,你想要阅读至少所有的http://docs.puppetlabs.com/learning/index.html

这应该可以做到:

rbenv::compile { "1.9.3-p327":
  user => "vagrant",
  home => "/home/vagrant",
}

exec {"rbenv-global-1.9.3-p327":
  command => "rbenv global 1.9.3-p327",
  path    => "/home/vagrant/.rbenv/bin",
  require => Rbenv::Compile['1.9.3-p327']
}

或者,您可以使用链接箭头来明确创建关系:

rbenv::compile { "1.9.3-p327":
  user => "vagrant",
  home => "/home/vagrant",
}

exec {"rbenv-global-1.9.3-p327":
  command => "rbenv global 1.9.3-p327",
  path    => "/home/vagrant/.rbenv/bin",
}

Rbenv::Compile['1.9.3-p327'] ->
Exec['rbenv-global-1.9.3-p327']

相关内容