Skip to content

Instantly share code, notes, and snippets.

@jescalan
Last active December 10, 2021 10:40
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jescalan/5746373 to your computer and use it in GitHub Desktop.
Save jescalan/5746373 to your computer and use it in GitHub Desktop.
install latest ruby via rbenv using salt stack
#
# ruby deps
#
rbenv_deps:
pkg.installed:
- names:
- git
- build-essential
- openssl
- curl
- zlib1g
- zlib1g-dev
- libssl-dev
- libyaml-dev
- libsqlite3-0
- libsqlite3-dev
- sqlite3
- libxml2-dev
- libxslt1-dev
- autoconf
- libc6-dev
- libncurses5-dev
- automake
- libtool
- bison
- subversion
#
# rbenv and ruby-build installation
#
/root/.rbenv:
file.directory:
- makedirs: True
https://github.com/sstephenson/rbenv.git:
git.latest:
- rev: master
- target: /root/.rbenv
- force: True
- require:
- pkg: rbenv_deps
- file: /root/.rbenv
https://github.com/sstephenson/ruby-build.git:
git.latest:
- rev: master
- target: /root/.rbenv/plugins
- force: True
- require:
- git: https://github.com/sstephenson/rbenv.git
- file: /root/.rbenv
/root/.profile:
file.append:
- text:
- export PATH="$HOME/.rbenv/bin:$PATH"
- eval "$(rbenv init -)"
- require:
- git: https://github.com/sstephenson/rbenv.git
#
# ruby installation
#
# this is currently not working
# ruby-{{ pillar['ruby']['version'] }}:
# rbenv.installed:
# - default: True
# - require:
# - git: https://github.com/sstephenson/ruby-build.git
/root/.rbenv/bin/rbenv install {{ pillar['ruby']['version'] }}:
cmd.run:
- require:
- git: https://github.com/sstephenson/ruby-build.git
/root/.rbenv/bin/rbenv rehash:
cmd.run:
- require:
- cmd: /root/.rbenv/bin/rbenv install {{ pillar['ruby']['version'] }}
/root/.rbenv/bin/rbenv global {{ pillar['ruby']['version'] }}
cmd.run:
- require:
- cmd: /root/.rbenv/bin/rbenv rehash
# /srv/pillar/ruby.sls
ruby:
version: 2.0.0-p195
@charl
Copy link

charl commented Sep 18, 2013

/root/.rbenv/bin/rbenv global {{ pillar['ruby']['version'] }}
  cmd.run:
    - require:
      - cmd: /root/.rbenv/bin/rbenv rehash

Should read:

/root/.rbenv/bin/rbenv global {{ pillar['ruby']['version'] }}:
  cmd.run:
    - require:
      - cmd: /root/.rbenv/bin/rbenv rehash

[Missing colon at the end of the key name]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment