我正嘗試使用Ansible在EC2服務器上安裝我們的服務之一所需的指南針。 通常我們安裝手動使用下面的命令 -安裝與指南針的指南針
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
然後運行羅盤編譯成功。 現在,當我嘗試使用Ansible操作手冊(使用shell模塊)運行這些命令時,系統找不到指南針命令。
我曾嘗試使用RVM官方Ansible角色(https://github.com/rvm/rvm1-ansible),而我得到的是更多的錯誤。
我已經嘗試使用apt安裝rubydev和rubygems集成,然後使用gem模塊安裝gem。這確實承認了指南針命令,但是當我嘗試編譯甚至顯示指南針版本時,它會返回錯誤。這裏是正在工作的羅盤-v,例如錯誤:
Errno::ENOENT on line ["25"] of /usr/lib/ruby/vendor_ruby/compass/version.rb: No such file or directory - /usr/lib/ruby/vendor_ruby/compass/../../VERSION.yml
Run with --trace to see the full backtrace
這是設法安裝指南針,但給我留下了我所提到的錯誤劇本:
---
- hosts: "{{ host_name }}"
become: yes
become_method : sudo
tasks:
- name: install ruby-dev
apt:
name: ruby-dev
- name: install rubygems
apt:
name: rubygems-integration
- name: install ruby compass
apt:
name: ruby-compass
...
會愛一些幫助。
你可以發佈你的劇本嗎? – ydaetskcoR
它失敗了什麼任務? – ydaetskcoR
就像我上面寫的 - 當前劇本運行成功,但是當我嘗試運行指南針編譯甚至指南針-v失敗時(手動安裝時它工作正常) –