--- - name: set up GOPATH if it is not already set lineinfile: dest: /etc/environment line: 'GOPATH={{ ansible_env.HOME }}/go' regexp: 'GOPATH=' state: present when: ansible_env.GOPATH is not defined - name: ensure user profile exists file: path: "{{ ansible_user_dir }}/.profile" state: touch - name: set up PATH for Go binaries lineinfile: dest: "{{ ansible_user_dir }}/.profile" line: 'PATH={{ ansible_env.PATH }}:{{ ansible_env.GOPATH }}/bin' 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/... - jteeuwen/go-bindata/go-bindata