From b6169eb3f2c0f7b05a5f74a12ea2d5942039a8f5 Mon Sep 17 00:00:00 2001 From: heqnx Date: Sun, 25 May 2025 08:40:36 +0300 Subject: added systemwide go path --- attackbox/tasks/golang_install.yaml | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/attackbox/tasks/golang_install.yaml b/attackbox/tasks/golang_install.yaml index df9c266..e67d508 100644 --- a/attackbox/tasks/golang_install.yaml +++ b/attackbox/tasks/golang_install.yaml @@ -1,10 +1,4 @@ -- name: check if golang is installed - stat: - path: /usr/local/go/bin/go - register: golang_installed - - name: download and extract golang - when: not golang_installed.stat.exists block: - name: get latest golang version shell: | @@ -28,12 +22,12 @@ path: /tmp/golang.tar.gz state: absent - - name: add golang to PATH - lineinfile: - path: "{{ ansible_env.HOME }}/.bashrc" - line: "{{ item }}" - create: yes - loop: - - "GOPATH={{ ansible_env.HOME }}/go" - - "PATH=$PATH:/usr/local/go/bin:{{ ansible_env.HOME }}/go:{{ ansible_env.HOME }}/go/bin" - + - name: set system-wide go environment variables + copy: + dest: /etc/profile.d/go_env.sh + content: | + export GOPATH=/root/go + export PATH=$PATH:/usr/local/go/bin:$GOPATH:$GOPATH/bin + owner: root + group: root + mode: '0644' -- cgit v1.2.3