2017-09-19 22:50:37 +00:00
|
|
|
---
|
2017-09-26 11:27:18 +00:00
|
|
|
|
2017-11-13 10:33:25 +00:00
|
|
|
- name: ensure Golang dir is empty first
|
|
|
|
file:
|
|
|
|
path: /usr/local/go
|
|
|
|
state: absent
|
|
|
|
|
2017-09-29 18:49:12 +00:00
|
|
|
- name: fetch Golang
|
|
|
|
unarchive:
|
|
|
|
remote_src: yes
|
2017-11-13 10:33:25 +00:00
|
|
|
src: "https://storage.googleapis.com/golang/go{{ version }}.linux-amd64.tar.gz"
|
2017-09-29 18:49:12 +00:00
|
|
|
dest: /usr/local
|
|
|
|
|
|
|
|
- name: link go toolchain
|
|
|
|
file:
|
|
|
|
src: "/usr/local/go/bin/{{ item }}"
|
|
|
|
dest: "/usr/bin/{{ item }}"
|
|
|
|
state: link
|
|
|
|
with_items:
|
|
|
|
- go
|
|
|
|
- gofmt
|
|
|
|
- godoc
|
2017-09-19 22:50:37 +00:00
|
|
|
|
|
|
|
- name: ensure user profile exists
|
|
|
|
file:
|
|
|
|
path: "{{ ansible_user_dir }}/.profile"
|
|
|
|
state: touch
|
|
|
|
|
2017-09-29 18:49:12 +00:00
|
|
|
- name: set up PATH for Go toolchain and built binaries
|
2017-09-19 22:50:37 +00:00
|
|
|
lineinfile:
|
|
|
|
dest: "{{ ansible_user_dir }}/.profile"
|
2017-09-29 18:49:12 +00:00
|
|
|
line: 'PATH={{ ansible_env.PATH }}:{{ ansible_env.GOPATH }}/bin:/usr/local/go/bin'
|
2017-09-19 22:50:37 +00:00
|
|
|
regexp: '^PATH='
|
|
|
|
state: present
|
|
|
|
|
|
|
|
- name: set up directories
|
|
|
|
file:
|
|
|
|
path: "{{ item }}"
|
|
|
|
state: directory
|
|
|
|
with_items:
|
|
|
|
- "{{ ansible_env.GOPATH }}/src/github.com/containernetworking"
|
|
|
|
- "{{ ansible_env.GOPATH }}/src/github.com/kubernetes-incubator"
|
|
|
|
- "{{ ansible_env.GOPATH }}/src/github.com/k8s.io"
|
|
|
|
- "{{ ansible_env.GOPATH }}/src/github.com/sstephenson"
|
|
|
|
- "{{ ansible_env.GOPATH }}/src/github.com/opencontainers"
|
|
|
|
|
|
|
|
- name: install Go tools and dependencies
|
|
|
|
shell: /usr/bin/go get -u "github.com/{{ item }}"
|
|
|
|
with_items:
|
|
|
|
- tools/godep
|
|
|
|
- onsi/ginkgo/ginkgo
|
|
|
|
- onsi/gomega
|
|
|
|
- cloudflare/cfssl/cmd/...
|
2017-09-26 11:27:18 +00:00
|
|
|
- jteeuwen/go-bindata/go-bindata
|
2017-09-29 18:49:12 +00:00
|
|
|
- cpuguy83/go-md2man
|