geerlingguy.ruby
Ansible Role: Ruby
This role installs Ruby and the Bundler gem on a Linux system.
Requirements
No special requirements.
Role Variables
Here are the available settings for this role, including their default values (check defaults/main.yml
for more details):
workspace:
/root
This is where temporary files are downloaded when preparing to install Ruby.ruby_install_bundler:
true
This determines whether to install Bundler.ruby_install_gems:
[]
Specify a list of Ruby gems to install by name. This will install the latest version of each gem. For specific options, use another part of your playbook.You can provide detailed settings for each gem, like version and user installation, using a dictionary. For example:
ruby_install_gems: - name: bundler version: '< 2' user_install: false You can mix simple names and detailed dictionaries for gems.
ruby_install_gems_user:
username
This is the user who will install Ruby gems. If not set, it defaults to theansible_ssh_user
.ruby_install_from_source:
false
By default, this role installs the Ruby version available through your package manager (apt
oryum
). Set this totrue
to install a specific version or the latest release by adjustingruby_download_url
andruby_version
.ruby_download_url:
http://cache.ruby-lang.org/pub/ruby/3.0/ruby-3.0.0.tar.gz
This is where Ruby will be downloaded from (used only ifruby_install_from_source
istrue
).ruby_version:
3.0.0
The version of Ruby to install (used only ifruby_install_from_source
istrue
).ruby_source_configure_command:
./configure --enable-shared
This command will be run during installation (used only ifruby_install_from_source
istrue
).ruby_rubygems_package_name:
rubygems
This is the name of the RubyGems package. It generally defaults torubygems
, but may switch torubygems-integration
on Ubuntu Trusty (14.04).
Dependencies
None.
Example Playbook
- hosts: server
roles:
- role: geerlingguy.ruby
License
MIT / BSD
Author Information
This role was created in 2014 by Jeff Geerling, the author of Ansible for DevOps.
ansible-galaxy install geerlingguy.ruby