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

1 Answer 1

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .