I am trying to install Bundler on my VPS using Ansible.
I already have rbenv set up and the global ruby is 2.1.0.
If I SSH as root into the server and run
I've met the similar environment issue when I tried to run commands as another user. As mentioned in this feature request you have two options to execute your command in login shell (that will load user environment). For example i'ld like to install bundler as rails user:
- name: Install Bundler
shell: gem install bundler
sudo_user: rails -i
or
- name: Install Bundler
command: sudo -iu rails gem install bundler