如何使用rvm1-ansible角色安装rvm来运行bundle install

问题描述 投票:2回答:1

我使用rv1-ansible角色安装了rvm:

- hosts: all
  remote_user: deploy

  roles:
    - { role: rvm_io.ruby,
        tags: ruby,
        rvm1_rubies: ['ruby-2.4.0'],
        rvm1_user: 'deploy'
      }

现在我想在应用程序目录中运行bundle install:

- hosts: all
  remote_user: deploy

  tasks:
    - name: Clone git repository
      git:
        dest: /home/deploy/public_html/app_name
        repo: [email protected]:user/app_name.git

    - name: Bundle install
      bundler: 
        state: present
        chdir: /home/deploy/public_html/app_name
        executable: ~/.rvm/gems/ruby-2.4.0/bin/bundle

但得到错误:"/usr/bin/env: 'ruby_executable_hooks': No such file or directory"

知道怎么做吗?

ruby-on-rails ansible rvm
1个回答
0
投票

您需要进行根安装 - 作为特定用户安装不起作用。有点信息为什么here - Ansible没有登录来运行命令所以不会选择用户特定的RVM东西。通过全局安装,rvmbundler以及所有其他废话,我不知道你在路径上需要哪些路径。

示例配置从rvm1-ansible文档中直接安装ruby系统:

- name: Configure servers with ruby support system wide
  hosts: all
  roles:
    - { role: rvm_io.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
      }
© www.soinside.com 2019 - 2024. All rights reserved.