Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gem install package failed, and Symlink is not work #129

Open
zarr12steven opened this issue Dec 16, 2016 · 4 comments
Open

Gem install package failed, and Symlink is not work #129

zarr12steven opened this issue Dec 16, 2016 · 4 comments

Comments

@zarr12steven
Copy link

ENVIORNMENT

remote server: CentOS Linux release 7.2.1511 (Core)

PURPOSE

After install rvm, and I want to use gem install compass

Ansible Config

I always use run root, my playbook is below there

---
- name: CentOS | Basic Setup
  hosts: app
  roles:
    - { role: rvm_io.ruby,
        tags: ruby,
        rvm1_rubies: ['ruby-2.0.0'],
        rvm1_user: 'root',
        become: True,
        rvm1_install_flags: '--auto-dotfiles'
      }

I add new file in rvm_io.ruby/tasks/gem.yml

---
- name: Install Compass
  gem: name=compass  state=present

and i add this file to rvm_io.ruby/tasks/main.yml

---

- name: Install RVM
  include: 'rvm.yml'
  become: yes
  become_user: '{{ rvm1_user }}'

- name: Install Ruby and Gems
  include: 'rubies.yml'
  become: yes
  become_user: '{{ rvm1_user }}'

- name: Install Gem Packages
  include: 'gem.yml'
  become: yes
  become_user: '{{ rvm1_user }}'

First error:

TASK [rvm_io.ruby : Install Compass] *******************************************
task path: /etc/ansible/roles/rvm_io.ruby/tasks/gem.yml:2
fatal: [192.168.1.10]: FAILED! => {"changed": false, "failed": true, "msg": "Failed to find required executable gem"}

so I fixed rvm_io.ruby/tasks/gem.yml

---
- name: Install Compass
  gem: name=compass  state=present executable=/root/.rvm/rubies/ruby-2.0.0-p648/bin/gem

Secondary error

TASK [rvm_io.ruby : Install Compass] *******************************************
fatal: [192.168.1.10]: FAILED! => {"changed": false, "cmd": "/root/.rvm/rubies/ruby-2.0.0-p648/bin/ruby query -n '^compass$'", "failed": true, "msg": "/root/.rvm/rubies/ruby-2.0.0-p648/bin/ruby: No such file or directory -- query (LoadError)", "rc": 1, "stderr": "/root/.rvm/rubies/ruby-2.0.0-p648/bin/ruby: No such file or directory -- query (LoadError)\n", "stdout": "", "stdout_lines": []}

Question1: but I don't have any idea, what can I do ?

Question2: and I want to know why the symlink not works ?

TASK [rvm_io.ruby : Symlink ruby related binaries on the system path] **********
task path: /etc/ansible/roles/rvm_io.ruby/tasks/rubies.yml:45
skipping: [192.168.1.10] => (item=erb)  => {"changed": false, "item": "erb", "skip_reason": "Conditional check failed", "skipped": true}
skipping: [192.168.1.10] => (item=executable-hooks-uninstaller)  => {"changed": false, "item": "executable-hooks-uninstaller", "skip_reason": "Conditional check failed", "skipped": true}
skipping: [192.168.1.10] => (item=gem)  => {"changed": false, "item": "gem", "skip_reason": "Conditional check failed", "skipped": true}
skipping: [192.168.1.10] => (item=irb)  => {"changed": false, "item": "irb", "skip_reason": "Conditional check failed", "skipped": true}
skipping: [192.168.1.10] => (item=rake)  => {"changed": false, "item": "rake", "skip_reason": "Conditional check failed", "skipped": true}
skipping: [192.168.1.10] => (item=rdoc)  => {"changed": false, "item": "rdoc", "skip_reason": "Conditional check failed", "skipped": true}
skipping: [192.168.1.10] => (item=ri)  => {"changed": false, "item": "ri", "skip_reason": "Conditional check failed", "skipped": true}
skipping: [192.168.1.10] => (item=ruby)  => {"changed": false, "item": "ruby", "skip_reason": "Conditional check failed", "skipped": true}
skipping: [192.168.1.10] => (item=testrb)  => {"changed": false, "item": "testrb", "skip_reason": "Conditional check failed", "skipped": true}

TASK [rvm_io.ruby : Symlink bundler binaries on the system path] ***************
task path: /etc/ansible/roles/rvm_io.ruby/tasks/rubies.yml:55
skipping: [192.168.1.10] => (item=bundle)  => {"changed": false, "item": "bundle", "skip_reason": "Conditional check failed", "skipped": true}
skipping: [192.168.1.10] => (item=bundler)  => {"changed": false, "item": "bundler", "skip_reason": "Conditional check failed", "skipped": true}
@lpaulmp
Copy link
Member

lpaulmp commented Dec 20, 2016

@zarr12steven Did you tried adding the installation path rvm1_install_path?

@zarr12steven
Copy link
Author

@lpaulmp I use default rvm1_install_path in rvm_io.ruby/defaults/main.yml

# Install path for rvm (defaults to user based install)
rvm1_install_path: '~/.rvm'

but when I added rvm1_symlink_to: '/bin' into my playbook file /etc/asnible/playbooks/centos.yml, then TASK [rvm_io.ruby : Symlink ruby related binaries on the system path] is working,below is my playbook

---
- name: CentOS | Basic Setup
  hosts: app
  roles:
    - { role: rvm_io.ruby,
        tags: ruby,
        rvm1_rubies: ['ruby-2.0.0'],
        rvm1_user: 'root',
        become: True,
        rvm1_rvm_check_for_updates: False,
        rvm1_symlink_to: '/bin',
        rvm1_install_flags: '--auto-dotfiles'
      }

@haslinger
Copy link

@zarr12steven Did you ever resolve this?

@olea
Copy link

olea commented Jul 12, 2019

I've spent a couple days fighting with the gem ansible module and environment configuration. Frustrated I've changed to just using shell invocations. With the stock gem module I never get my gems installed under ~/.rvm but always at ~/.gem.

I've needed to explicit a correct PATH too, in my case:

  environment:
    PATH: /home/deploy/.rvm/gems/ruby-2.3.1/bin:/home/deploy/.rvm/gems/ruby-2.3.1@global/bin:/home/deploy/.rvm/rubies/ruby-2.3.1/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/deploy/.rvm/bin:/home/deploy/.local/bin:/home/deploy/bin:/home/deploy/.gem/ruby/2.3.0/bin

Please consider add something about this to the documentation.

Other than this, thanks for the job!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants