dongyongju9560 2015-10-19 13:48
浏览 56
已采纳

Ansible GVM-Go版本管理器

Writing my first Ansible Script. I am trying to install GVM.

I install GVM ok (I logged into the box and checked) when I run gvm version on the box direct I get: Go Version Manager v1.0.22 installed at /d1/golang/gvm

But when I run it as a command in Ansible:

- name: GVM Version
  shell: gvm version
  become: yes

I get the following error:

failed: [prod2] => {"changed": true, "cmd": "gvm version", "delta": "0:00:00.002081", "end": "2015-10-19 13:41:54.123575", "rc": 127, "start": "2015-10-19 13:41:54.121494", "warnings": []}
stderr: /bin/bash: gvm: command not found

FATAL: all hosts have already failed -- aborting

I am running a bash script which contains: source /d1/golang/gvm/scripts/gvm which is supposed to ensure you don't have to restart the terminal - see ansible command below.

- name: Run gvm source
  shell: . /etc/profile.d/golang.sh executable=/bin/bash
  become: yes

Any ideas what I am doing wrong?

  • 写回答

1条回答 默认 最新

  • dslf46995 2015-10-19 14:30
    关注

    I ended up running two commands in the ansible command

    name: Install go
      shell: . /etc/profile.d/golang.sh && gvm install go1.5 executable=/bin/bash
    

    This ensures the source has been set then allows the gvm command to be run.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 ROS Turtlebot3 多机协同自主探索环境时遇到的多机任务分配问题,explore节点
  • ¥15 Matlab怎么求解含参的二重积分?
  • ¥15 苹果手机突然连不上wifi了?
  • ¥15 cgictest.cgi文件无法访问
  • ¥20 删除和修改功能无法调用
  • ¥15 kafka topic 所有分副本数修改
  • ¥15 小程序中fit格式等运动数据文件怎样实现可视化?(包含心率信息))
  • ¥15 如何利用mmdetection3d中的get_flops.py文件计算fcos3d方法的flops?
  • ¥40 串口调试助手打开串口后,keil5的代码就停止了
  • ¥15 电脑最近经常蓝屏,求大家看看哪的问题