rvm1-ansible

repository·master·Indexed 43 days ago

https://github.com/rvm/rvm1-ansible

An Ansible role (rvm.ruby) designed to install and manage multiple Ruby versions using RVM (Ruby Version Manager). It supports single-user and system-wide installations and provides pre-compiled binaries to accelerate deployment.

Tokens
1.5K
Snippets
6
Records
6
Agent score
5%

What's inside rvm1-ansible

  1. Delete a specific Ruby version

    master

    To remove a specific Ruby version, use the rvm1_delete_ruby variable. You can pass this via Ansible's --extra-vars flag during playbook execution.

    ansible-playbook playbook.yml --extra-vars 'rvm1_delete_ruby=ruby-2.1.0'
  2. Configure rvm1-ansible role variables

    master

    The following variables are available to configure the behavior of the rvm.ruby role. Note that specific configurations are required depending on whether you are performing a single-user or a system-wide (root-based) installation.

    # Install 1 or more versions of ruby
    # The last ruby listed will be set as the default ruby
    rvm1_rubies:
      - 'ruby-2.3.1'
    
    # Install the bundler gem
    rvm1_bundler_install: True
    
    # Delete a specific version of ruby (ie. ruby-2.1.0)
    rvm1_delete_ruby:
    
    # Install path for rvm (defaults to single user)
    # NOTE: If you are doing a ROOT BASED INSTALL then make sure you
    #       set the install path to something like '/usr/local/rvm'
    rvm1_install_path: '~/.rvm'
    
    # Add or remove any install flags
    # NOTE: If you are doing a ROOT BASED INSTALL then make sure you
    #       REMOVE the --user-install flag below
    rvm1_install_flags: '--auto-dotfiles  --user-install'
    
    # Add additional ruby install flags
    rvm1_ruby_install_flags:
    
    # Set the owner for the rvm directory
    # NOTE: If you are doing a ROOT BASED INSTALL then make sure you
    #       set rvm1_user to 'root'
    rvm1_user: 'ubuntu'
    
    # URL for the latest installer script
    rvm1_rvm_latest_installer: 'https://raw.githubusercontent.com/rvm/rvm/master/binscripts/rvm-installer'
    
    # rvm version to use
    rvm1_rvm_version: 'stable'
    
    # Check and update rvm, disabling this will force rvm to never update
    rvm1_rvm_check_for_updates: True
    
    # GPG key verification, use an empty string if you want to skip this
    rvm1_gpg_keys: '409B6B1796C275462A1703113804BB82D39DC0E3'
    
    # The GPG key server
    rvm1_gpg_key_server: 'hkp://keys.openpgp.org'
    
    # autolib mode, see https://rvm.io/rvm/autolibs
    rvm1_autolib_mode: 3
    
    # Symlink binaries to system path
    rvm1_symlink: true
  3. Configure a single-user Ruby installation

    master

    To install Ruby for a single user (the default behavior), use the following playbook structure. This uses the default --user-install flag and installs to the user's home directory.

    ---
    
    - name: Configure servers with ruby support for single user
      hosts: all
    
      roles:
        - { role: rvm.ruby,
            tags: ruby,
            rvm1_rubies: ['ruby-2.3.1'],
            rvm1_user: 'ubuntu'
          }
  4. Install Ruby to a specific user's home directory

    master

    To install Ruby to a user other than the ansible_user, you must use become (root access) because you are writing to a directory outside the current user's home. Set rvm1_install_path to the target user's RVM directory and keep the --user-install flag.

    rvm1_install_flags: '--auto-dotfiles --user-install'
    rvm1_install_path: '/home/someuser/.rvm'
  5. Configure a system-wide Ruby installation

    master

    To perform a system-wide installation, you must run the playbook with become: yes (root privileges). You must also modify rvm1_install_flags to remove --user-install and specify a system-level rvm1_install_path (e.g., /usr/local/rvm).

    ---
    - name: Configure servers with ruby support system wide
      hosts: all
      roles:
        - { role: rvm.ruby,
            tags: ruby,
            become: yes,
    
            rvm1_rubies: ['ruby-2.2.5','ruby-2.3.1'],
            rvm1_install_flags: '--auto-dotfiles',     # Remove --user-install from defaults
            rvm1_install_path: /usr/local/rvm,         # Set to system location
            rvm1_user: root                            # Need root account to access system location
          }