-
Notifications
You must be signed in to change notification settings - Fork 1
/
CentOS7x_Install-Go-Lang-playbook.yml
58 lines (44 loc) · 1.97 KB
/
CentOS7x_Install-Go-Lang-playbook.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
53
54
55
56
57
58
---
################################################################################
# description: Installs Go Programming Language on CentOS7x
# usage: ansible-playbook CentOS7x_Install-Go-Lang-playbook.yml --extra-vars 'HostOrGroup=YourServerOrGroupNameGoesHere'
# author: Ernest G. Wilson II <ErnestGWilsonII@gmail.com> (https://github.com/ernestgwilsonii)
# license: MIT
################################################################################
# Ansible Playbook options
# REF: http://docs.ansible.com/ansible/playbooks.html
#####################################################
- name: Install Go Programming Language on CentOS7x
hosts: "{{ HostOrGroup|default ('FATAL ERROR --> HostOrGroup NOT SET! You must specify either a Host or a Group name!') }}"
serial: "100%"
gather_facts: False
tasks:
# file - Sets attributes of files and directories
# http://docs.ansible.com/ansible/file_module.html
##################################################
- name: Create directory /usr/local/go
file:
path: /usr/local/go
state: directory
mode: 0755
# unarchive - Unpacks an archive after (optionally) copying it from the local machine
# REF: http://docs.ansible.com/ansible/unarchive_module.html
############################################################
- name: Install Go
unarchive:
src: https://storage.googleapis.com/golang/go1.6.3.linux-amd64.tar.gz
dest: /usr/local
copy: no
# Update various configuration files
# REF: http://docs.ansible.com/ansible/lineinfile_module.html
#############################################################
- name: Add /usr/local/go/bin to the PATH environment variable in /root/.bashrc for root
lineinfile:
dest: /root/.bashrc
state: present
line: 'export PATH=$PATH:/usr/local/go/bin'
- name: Add export GOPATH=/usr/local environment variable in /root/.bashrc for root
lineinfile:
dest: /root/.bashrc
state: present
line: 'export GOPATH=/usr/local'