Ansible Playbook to deploy ruby to Debian or RHEL Based systems via the ruby-build tool.
If you are like me and have to manage multiple linux distributions across Production, Staging, and Development and find default packages for ruby installs a nightmare to work with then this may be for you.
This approach was spawned out of mostly a hatred for RVM, Rbenv and all the other ruby version managers etc. and the attempt to simplify the overall server installs in a clean, streamline, and replicable way.
This uses the ruby-build tool (https://github.com/sstephenson/ruby-build) to handle the source intsalls and will be updated automatically every time this playbook is run to ensure it has the latest ruby definitions.
- Installs packages required for ruby to be installed
- Installs the ruby-build tool
- Installs Ruby From Source to /usr/local/ruby-$VERSION
- Links the source ruby install to /usr/local/ruby for easy reference
- Updates the /etc/environments to ensure the ruby path is exported
- Updates /etc/sudoers to let the ruby binares be accessible w/ sudo
The play is smart enough to see if ruby is already installed it will skip the source installation.
This play inclues variables for RHEL / Deb required packages as well as two default variables.
All variables are prefixed with the name of the play "ruby_builder"
---
ruby_builder_ruby_version: 2.1.0
ruby_builder_environment_path: "/usr/local/ruby/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
ruby_builder_version = The version of ruby to be installed
ruby_builder_environment_path = The path to set in /etc/environment used by templates/environment.j2
I would advise against changing these as they shouldn't need modified.
I am more fluent with RHEL based systems so its more minimalistic than the Debian based systems.
---
ruby_builder_rhel_ruby_dependencies:
- git
- gcc-c++
- make
- patch
- autoconf
- openssl-devel
- readline-devel
- libyaml-devel
- zlib-devel
ruby_builder_deb_ruby_dependencies:
- git
- libreadline-dev
- libssl-dev
- libyaml-dev
- zlib1g-dev
Please submit issues or contact me to update other distros this works with that I have not tested.
Fedora:
- 18 Spherical Cow
- 19 Schrodinger's Cat
- 20 Heisenbug
Ubuntu:
- 12.04 Precise
- 13.10 Saucy