-
Notifications
You must be signed in to change notification settings - Fork 18
/
tasks_go.yml
52 lines (45 loc) · 1.55 KB
/
tasks_go.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# installs Go (http://golang.org/) Dependency for gitlab
---
- name: GO | Check if installed
command: test -x /usr/local/go/bin/go
changed_when: False
ignore_errors: yes
register: go_present
tags:
-go
- name: Go | Download distribution
get_url: url="https://storage.googleapis.com/golang/go{{ go_version | default('1.12.3') }}.linux-amd64.tar.gz" dest=/tmp/go.tar.gz
when: go_present is failed
tags:
-go
- name: Go | Unpack distribution
unarchive: src=/tmp/go.tar.gz dest=/usr/local copy=no
become: yes
when: go_present is failed
tags:
-go
- name: GO | prepare /etc/profile.d/go_path.sh
file: path=/etc/profile.d/go_path.sh state=touch mode="u=rw,g=r,o=r"
become: yes
tags:
-go
- name: Add the Go bin directory to the PATH environment variable for all users
lineinfile: dest=/etc/profile.d/go_path.sh regexp="{{ item.regexp }}" line="{{ item.line }}"
become: yes
with_items:
- {regexp: "^export PATH=.*", line: "export PATH=$PATH:/usr/local/go/bin"}
tags:
-go
- name: GO | prepare /etc/profile.d/go_path.sh
file: path=/etc/profile.d/go_path.sh state=touch mode="u=rw,g=r,o=r"
become: yes
tags:
-go
- name: Set GOPATH for all users
lineinfile: dest=/etc/profile.d/go_path.sh regexp="{{ item.regexp }}" line="{{ item.line }}"
with_items:
- {regexp: "^export GOPATH=.*", line: "export GOPATH=/usr/local/go"}
- {regexp: "^export PATH=.*", line: "export PATH=$GOPATH/bin:$PATH"}
become: yes
tags:
-go