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?
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.