1
1

More than 5 years have passed since last update.

puppetでsourceコマンドでrbenv.shを読み込ませるのってどうしたらよいのだろう。

Posted at
  file { 'rbenv/profile.d/rbenv.sh':
    path    => '/etc/profile.d/rbenv.sh',
    content => '## rbenv setting
export RBENV_ROOT="/usr/local/rbenv"
export PATH="/usr/local/rbenv/bin:$PATH"
eval "$(rbenv init -)"
',
    require => Exec['clone rbenv']
  }
  ~>
  exec { 'source /etc/profile.d/rbenv.sh':
    command => "bash -c 'source /etc/profile.d/rbenv.sh'",
    path    => ['/bin', '/usr/bin', '/usr/local/rbenv/bin', '/usr/local/rbenv/plugins/ruby-build/bin/'],
    user    => 'vagrant',
    refreshonly => true,
    require => File['rbenv/profile.d/rbenv.sh']
  }

vagrant環境でpuppetで開発環境を作っていて、
rbenv.shを/etc/profile.dに置いて、それをsourceコマンドで読み込ませてやろうと思って作った。

イメージとして、

vagrant ssh
cd /vagrant
sudo puppet apply hogemoge
# この後、source /etc/profile.d/rbenv.shが読み込まれた状態にしたい

というのをやろうと思って、ががっと、puppetを作ってみたが、
冷静に考えると上の方法だと無理だよなーと。。。

どうすればいいんだろうか。。。普通に手動で読み込ませるか、vagrantを再起動するしかないのか。。。

とか思ったけど、puppetでそこまでやるのって、違うのか?

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1