我有一个简单的ansible playbook,它构建了etcd:
- hosts: all
vars:
repo_location: /var/lib/etcd/src/
roles:
- joshualund.golang
#to install go
tasks:
- name: Clone etcd
action: git repo=https://github.com/coreos/etcd dest={{repo_location}}
- name: Build etcd
command: chdir={{repo_location}} ./build
- name: Start etcd
service: ./bin/etcd state=started
所以当我在远程启动ansible-playbook时,“Build etcd”失败并出现错误:
失败:[test] => {“已更改”:true,“cmd”:[“./ build”],“delta”:“0:00:00.002628”,“end”:“2014-06-10 07 :44:23.952227“,”rc“:127,”start“:”2014-06-10 07:44:23.949599“} stderr:./ build:17:./ build:go:not found
“build”中的第17行包含以下内容:
go install github.com/coreos/etcd
但是安装了go,我可以在远程服务器上手动构建etcd . 我究竟做错了什么?
1 回答
模块
joshualund.golang
安装go
到非标准目录/usr/local/go
(查看sources)所以问题很可能是因为这个事实 .要解决它,你应该以某种方式更新ansible使用的
$PATH
变量 . 其中一种方法是明确指定它: