我有一个构建 etcd 的简单 ansible 剧本:
- 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
因此,当我以 root 身份在遥控器上启动 ansible-playbook 时,“Build etcd”失败并出现错误:
失败:[test] => {"changed": 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。我究竟做错了什么?