3

I have the following code:

  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",
  }

I would like to add a require to "rbenv-global-1.9.3-p327" because it should be executed after rbenv::compile but I do not know the right syntax

2

If you don't know the right syntax, why don't you look it up? The Puppet documentation is excellent, especially the "Learning Puppet" sections. You want the require keyword, and you want to read at least all of http://docs.puppetlabs.com/learning/index.html.

This should do it:

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']
}

Alternatively you can use chaining arrows to create the relationship explicitly:

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']

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.