我正尝试使用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失败时(手动安装时它工作正常) –