https://github.com/cimon-io/ansible-role-ruby
https://github.com/cimon-io/ansible-role-ruby
ansible ansible-role rbenv ruby
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/cimon-io/ansible-role-ruby
- Owner: cimon-io
- Created: 2017-11-07T06:14:55.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2019-11-20T07:56:36.000Z (over 6 years ago)
- Last Synced: 2025-07-01T11:04:43.560Z (about 1 year ago)
- Topics: ansible, ansible-role, rbenv, ruby
- Size: 6.84 KB
- Stars: 0
- Watchers: 6
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Ansible ruby role
An ansible role that installs and configures Ruby with rbenv.
The role includes the following tasks:
1. Install necessary ruby dependencies specified by the `ruby_software_dependencies` variable.
2. Install/update rbenv as `ruby_user` at `$HOME/.rbenv`.
3. Install ruby-build plugin at `$HOME/.rbenv/plugins`.
4. Append rbenv bin to the PATH variable.
5. Initiate rbenv for ssh sessions.
6. Install ruby versions listed in the `ruby_versions` variable. Set the required `ruby_global_version` as global.
7. Install/update RubyGems.
This role can be run under all versions of Ubuntu and Debian.
## Requirements
None
## Role Variables
Available variables are listed below, along with default values (see `defaults/main.yml`):
```yaml
ruby_user: deploy # A user for whom ruby is installed
ruby_group: deploy # The user name and group must be present in the system
```
Specify rbenv and ruby versions which should be installed:
```yaml
ruby_rbenv_version: "v1.1.2" # rbenv version
ruby_versions: # list of ruby versions
- "2.6.4"
```
The first of the requested ruby versions (if there is any) will be set as global:
```yaml
ruby_global_version: "{{ ruby_versions[0] | default('') }}"
ruby_global_gems: [] # list of ruby global gems to install
```
All necessary dependencies and other variables are specified at `vars/main`:
```yaml
ansible_become: yes
apt_cache_valid_time: 86400
ruby_software_dependencies:
- build-essential
- libcurl4-openssl-dev
- libmysqlclient-dev
- libreadline-dev
- libreadline6-dev
- libssl-dev
- libxml2-dev
- libxslt1-dev
- zlib1g-dev
- libmagickwand-dev
```
## Dependencies
- Role: [users]() - an ansible role for managing user and group accounts. A list of `users_accounts` must include a user with a name and a group equal to `ruby_user` and `ruby_group` variables respectively.
## Example Playbook
A playbook example:
```yaml
- hosts: web
roles:
- role: ruby
ruby_versions:
- "2.6.3"
- "2.6.4"
```
An example of variables:
```yaml
ruby_user: developer # A user under whom the role is run
ruby_group: developer # The user name and group must be present in the system
ruby_versions: ["2.5.3", "2.6.4"] # Ruby version which will be installed
```
## License
Licensed under the [MIT License](https://opensource.org/licenses/MIT).