【问题标题】:How to run bundle install with rvm installed using rvm1-ansible role如何使用 rvm1-ansible 角色安装 rvm 运行 bundle install
【发布时间】:2017-03-19 16:03:32
【问题描述】:

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

- hosts: all
  remote_user: deploy

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

现在我想在应用程序目录中运行捆绑安装:

- hosts: all
  remote_user: deploy

  tasks:
    - name: Clone git repository
      git:
        dest: /home/deploy/public_html/app_name
        repo: git@github.com: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】:

    您需要进行 root 安装 - 以特定用户身份安装不起作用。为什么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
          }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-02-17
      • 1970-01-01
      • 2016-08-02
      • 1970-01-01
      • 2017-04-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多