-
Notifications
You must be signed in to change notification settings - Fork 74
/
main.yml
36 lines (31 loc) · 964 Bytes
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
---
- name: Download the Go tarball
get_url:
url: "{{ go_download_location }}"
dest: /usr/local/src/{{ go_tarball }}
checksum: "{{ go_tarball_checksum }}"
- name: Register the current Go version (if any)
command: /usr/local/go/bin/go version
ignore_errors: yes
register: go_version
changed_when: false
- name: Remove old installation of Go
file:
path: /usr/local/go
state: absent
when: go_version|failed or go_version.stdout != go_version_target
- name: Extract the Go tarball if Go is not yet installed or not the desired version
unarchive:
src: /usr/local/src/{{ go_tarball }}
dest: /usr/local
copy: no
when: go_version|failed or go_version.stdout != go_version_target
- name: Add the Go bin directory to the PATH environment variable for all users
copy:
src: go-bin.sh
dest: /etc/profile.d
- name: Set GOPATH for all users
copy:
src: go-path.sh
dest: /etc/profile.d
when: set_go_path