rvm / rvm1-ansible

The official ansible RVM role to install and manage your Ruby versions.
MIT License
271 stars 136 forks source link

Support for Amazon Linux 2 #181

Closed e-moshaya closed 5 years ago

e-moshaya commented 5 years ago

I get the following error on Amazon Linux 2

TASK [rvm.ruby : Install rubies] *********************************************** failed: [localhost] (item={'_ansible_parsed': True, 'stderr_lines': [u'Ruby ruby-2.3.1 is not installed.'], u'changed': False, u'stdout': u'', '_ansible_item_result': True, u'msg': u'non-zero return code', u'delta': u'0:00:00.303323', 'stdout_lines': [], 'failed_when_result': False, '_ansible_item_label': u'ruby-2.3.1', u'end': u'2018-11-06 20:31:45.547585', '_ansible_no_log': False, 'item': u'ruby-2.3.1', u'cmd': [u'/usr/local/rvm/bin/rvm', u'ruby-2.3.1', u'do', u'true'], u'failed': False, u'stderr': u'Ruby ruby-2.3.1 is not installed.', u'rc': 2, u'invocation': {u'module_args': {u'warn': True, u'executable': None, u'_uses_shell': False, u'_raw_params': u'/usr/local/rvm/bin/rvm ruby-2.3.1 do true', u'removes': None, u'argv': None, u'creates': None, u'chdir': None, u'stdin': None}}, u'start': u'2018-11-06 20:31:45.244262', '_ansible_ignore_errors': None}) => {"changed": true, "cmd": ["/usr/local/rvm/bin/rvm", "install", "ruby-2.3.1"], "delta": "0:00:02.128669", "end": "2018-11-06 20:31:47.963158", "item": {"changed": false, "cmd": ["/usr/local/rvm/bin/rvm", "ruby-2.3.1", "do", "true"], "delta": "0:00:00.303323", "end": "2018-11-06 20:31:45.547585", "failed": false, "failed_when_result": false, "invocation": {"module_args": {"_raw_params": "/usr/local/rvm/bin/rvm ruby-2.3.1 do true", "_uses_shell": false, "argv": null, "chdir": null, "creates": null, "executable": null, "removes": null, "stdin": null, "warn": true}}, "item": "ruby-2.3.1", "msg": "non-zero return code", "rc": 2, "start": "2018-11-06 20:31:45.244262", "stderr": "Ruby ruby-2.3.1 is not installed.", "stderr_lines": ["Ruby ruby-2.3.1 is not installed."], "stdout": "", "stdout_lines": []}, "msg": "non-zero return code", "rc": 1, "start": "2018-11-06 20:31:45.834489", "stderr": "No binary rubies available for: unknown/libc-2.26/x86_64/ruby-2.3.1.\nContinuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.\nwhich: no patch in (/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/rvm/bin)\n\nRVM was not able to detect your system type and does not know how to load extra library paths for your system (if it's needed), read:\n\n rvm help autolibs\n\nfor details how to disable this message.\n\nRequirements installation failed with status: 1.", "stderr_lines": ["No binary rubies available for: unknown/libc-2.26/x86_64/ruby-2.3.1.", "Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.", "which: no patch in (/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/rvm/bin)", "", "RVM was not able to detect your system type and does not know how to load extra library paths for your system (if it's needed), read:", "", " rvm help autolibs", "", "for details how to disable this message.", "", "Requirements installation failed with status: 1."], "stdout": "Searching for binary rubies, this might take some time.\nChecking requirements for unknown.\nInstall: patch", "stdout_lines": ["Searching for binary rubies, this might take some time.", "Checking requirements for unknown.", "Install: patch"]}

tsz662 commented 5 years ago

If you have no problem with ruby 2.4, you can install ruby2.4.4 like so: $ sudo amazon-linux-extras install ruby2.4 -y

For reference,

$ amazon-linux-extras list
  0  ansible2                 available    [ =2.4.2  =2.4.6 ]
  2  httpd_modules            available    [ =1.0 ]
  3  memcached1.5             available    [ =1.5.1 ]
  4  nginx1.12                available    [ =1.12.2 ]
  5  postgresql9.6            available    [ =9.6.6  =9.6.8 ]
  6  postgresql10             available    [ =10 ]
  8  redis4.0                 available    [ =4.0.5  =4.0.10 ]
  9  R3.4                     available    [ =3.4.3 ]
 10  rust1                    available    \
        [ =1.22.1  =1.26.0  =1.26.1  =1.27.2 ]
 11  vim                      available    [ =8.0 ]
 12  golang1.9                available    [ =1.9.2 ]
 13  ruby2.4           available      [ =2.4.2  =2.4.4 ]
 15  php7.2                   available    \
        [ =7.2.0  =7.2.4  =7.2.5  =7.2.8  =7.2.11 ]
 16  php7.1                   available    [ =7.1.22 ]
 17  lamp-mariadb10.2-php7.2  available    \
        [ =10.2.10_7.2.0  =10.2.10_7.2.4  =10.2.10_7.2.5
          =10.2.10_7.2.8  =10.2.10_7.2.11 ]
 18  libreoffice              available    [ =5.0.6.2_15  =5.3.6.1 ]
 19  gimp                     available    [ =2.8.22 ]
 20  docker=latest            enabled      \
        [ =17.12.1  =18.03.1  =18.06.1 ]
 21  mate-desktop1.x          available    [ =1.19.0  =1.20.0 ]
 22  GraphicsMagick1.3        available    [ =1.3.29 ]
 23  tomcat8.5                available    [ =8.5.31  =8.5.32 ]
 24  epel                     available    [ =7.11 ]
 25  testing                  available    [ =1.0 ]
 26  ecs                      available    [ =stable ]
 27  corretto8=latest         enabled      [ =1.8.0_192 ]
 28  firecracker              available    [ =0.11 ]
thbar commented 5 years ago

@e-moshaya the error you see mentions:

RVM was not able to detect your system type and does not know how to load extra library paths for your system (if it's needed)

You can configure the role to avoid trying to install libs this way:

# We install the libs ourselves via ansible
rvm1_autolib_mode: read-fail

(see https://rvm.io/rvm/autolibs for the available values - default is 3 so install-packages)

After that you'll have to install the missing packages yourself. Here is what I do on Ubuntu, for instance:

# Packages required when working with rvm install ruby-x.y.z
packages_for_rvm_autolib:
  - autoconf
  - automake
  - libyaml-dev
  - libsqlite3-dev
  - sqlite3
  - bison
  - pkg-config
  - libgmp-dev
  - libgdbm-dev
  - libncurses5-dev
  - libtool
  - libffi-dev
  - libreadline6-dev
  - g++
  - git
  - libssl-dev
  - zlib1g-dev

then later:

- name: Install RVM autolibs manually
  action: apt pkg={{item}} state=present
  become: yes
  with_items: "{{ packages_for_rvm_autolib }}"

On a sidenote, Ruby 2.3.1 has security issues, you are encouraged to upgrade to latest 2.3.x. It will also EOL on 2019-03-31 (see https://www.ruby-lang.org/en/downloads/branches/).

pkuczynski commented 5 years ago

@e-moshaya can you post output of cat /etc/*release

e-moshaya commented 5 years ago

@pkuczynski here's the output:

NAME="Amazon Linux" VERSION="2" ID="amzn" ID_LIKE="centos rhel fedora" VERSION_ID="2" PRETTY_NAME="Amazon Linux 2" ANSI_COLOR="0;33" CPE_NAME="cpe:2.3: o :amazon:amazon_linux:2" HOME_URL="https://amazonlinux.com/" Amazon Linux 2

pkuczynski commented 5 years ago

I applied a fix in https://github.com/rvm/rvm/pull/4568. You can try with rvm get master (without ansible please)