I installed rvm using rv1-ansible role:
- hosts: all
remote_user: deploy
roles:
- { role: rvm_io.ruby,
tags: ruby,
rvm1_rubies: ['ruby-2.4.0'],
rvm1_user: 'deploy'
}
Now I would like to run bundle install inside application directory:
- 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
But get error: "/usr/bin/env: 'ruby_executable_hooks': No such file or directory"
Any idea how to do this?
You need to do a root install - installing as a specific user does not work. Little bit of info why here - Ansible is not logging in to run commands so doesn't pick up user-specific RVM stuff. By installing globally, rvm
and bundler
and all the other crap I don't know about which you need on the path is available on the path.
Example config installing ruby system wide ripped right from the rvm1-ansible
docs:
- 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
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.