I'm also receiving an error when trying to install compass using a playbook 
(on an AWS EC2 instance)
Usually we use the following script to install compass - 

curl -L https://get.rvm.io | bash -s stable
gpg --keyserver hkp://keys.gnupg.net --recv-keys 
409B6B1796C275462A1703113804BB82D39DC0E3
source ~/.rvm/scripts/rvm
echo "source ~/.rvm/scripts/rvm" >> ~/.bashrc
rvm install 2.1.2
rvm use 2.1.2 --default
gem install compass


I've tried converting this to script to the following playbook -
---
- hosts: "{{ host_name }}"
  become: yes
  become_user : deploy3
  tasks:
    - name: get gpg
      shell: "gpg --keyserver hkp://keys.gnupg.net --recv-keys 
409B6B1796C275462A1703113804BB82D39DC0E3"
    - name: install rvm
      shell: "curl -L https://get.rvm.io | bash -s stable"
    - name: install rvm 2.1.2
      shell: "/home/deploy2/.rvm/bin/rvm install 2.1.2"
    - name: use rvm 2.1.2 by default and install compass
      shell: "bash -lc \"/home/deploy2/.rvm/bin/rvm use 2.1.2 --default && 
/usr/bin/gem install compass\""
...

deploy is not a sudoer, but when I try to install compass manually it 
succeeds, and as a playbook I receive the following error - You don't have 
write permissions into the /var/lib/gems/1.9.1 directory.

I've tried installing compass any other way, including the one suggested 
here, but everything I try fails with various errors.
Has anyone encountered this issue and prevailed?
On Saturday, August 2, 2014 at 7:09:26 AM UTC+3, Tze Yang Ng wrote:
>
> Hi,
>
> I am new to Vagrant and Ansible. Trying to use a playbook to install 
> compass using gem command but got the following error. Seem like i miss 
> some setting on env?
>
> TASK: [ruby | Ruby | Install compass gem] 
> ************************************* 
>
> failed: [default] => {"failed": true}
>
> msg: Failed to find required executable gem
>
> FATAL: all hosts have already failed -- aborting
>
> This is the playbook content:
>
> ---
>
> - name: Ruby | Install Ruby
>
>   apt: pkg=ruby update-cache=yes
>
>   sudo: yes
>
>   tags: ruby
>
>
> - name: Ruby | Install compass gem
>
>   gem: name=compass
>
>   sudo: yes
>
>   tags: ruby
>
> Please help.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/9bd6c3d7-ea66-4fab-b473-1cf23c0d35b0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to