Install Bundler gem using Ansible

前端 未结 6 483
忘了有多久
忘了有多久 2020-12-14 00:46

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

6条回答
  •  庸人自扰
    2020-12-14 01:21

    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
    

提交回复
热议问题