1
0
Fork 0
mirror of https://github.com/mdlayher/homelab.git synced 2024-12-14 11:47:32 +00:00

golang: initial commit

This commit is contained in:
Matt Layher 2016-04-15 22:02:20 -04:00
parent 952e552d41
commit 2393e9dfff
No known key found for this signature in database
GPG key ID: 77BFE531397EDE94

View file

@ -0,0 +1,43 @@
---
- hosts: golang
vars:
# Personal Go configuration
- golang_user: "root"
- golang_home_dir: "/root"
- golang_personal_gopath: "github.com/mdlayher"
# Go installation configuration
- golang_url: "https://storage.googleapis.com/golang/go1.6.1.linux-amd64.tar.gz"
- golang_tgz: "/tmp/golang.tar.gz"
- golang_sha256: "6d894da8b4ad3f7f6c295db0d73ccc3646bce630e1c43e662a0120681d47e988"
- golang_root: "/usr/local/go"
tasks:
- name: install git
apt: pkg=git state=installed
- name: install mercurial
apt: pkg=mercurial state=installed
- name: download and checksum go tarball
get_url: url={{ golang_url }} dest={{ golang_tgz }} checksum=sha256:{{ golang_sha256 }}
- name: unpack tarball
unarchive: src={{ golang_tgz }} dest=/usr/local/ copy=no
- name: insert go configuration into shell configuration
blockinfile:
dest: /{{ golang_user }}/.bashrc
marker: "# {mark} ansible-managed Go configuration"
block: |
export GOROOT={{ golang_root }}
export GOROOT_BOOTSTRAP=$GOROOT
export GOPATH=$HOME
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin
- name: create personal GOPATH location
file: path={{ golang_home_dir }}/src/{{ golang_personal_gopath }} state=directory
- name: symlink personal GOPATH location to ~/go
file: dest={{ golang_home_dir }}/go src={{ golang_home_dir }}/src/{{ golang_personal_gopath }} owner={{ golang_user }} group={{ golang_user }} state=link
- name: remove temporary go tarball
file: path={{ golang_tgz }} state=absent