diff options
author | heqnx <root@heqnx.com> | 2025-05-25 08:40:49 +0300 |
---|---|---|
committer | heqnx <root@heqnx.com> | 2025-05-25 08:40:49 +0300 |
commit | f58f7a49a6eef972ca216aca249e47412abb7558 (patch) | |
tree | 1fffd6c18493f36b024ee30f65c676bb4045f562 | |
parent | b6169eb3f2c0f7b05a5f74a12ea2d5942039a8f5 (diff) | |
download | ansible-playbooks-f58f7a49a6eef972ca216aca249e47412abb7558.tar.gz ansible-playbooks-f58f7a49a6eef972ca216aca249e47412abb7558.zip |
added systemwide go path
-rw-r--r-- | sliver-c2/playbook.yaml | 1 | ||||
-rw-r--r-- | sliver-c2/tasks/golang_install.yaml | 33 |
2 files changed, 34 insertions, 0 deletions
diff --git a/sliver-c2/playbook.yaml b/sliver-c2/playbook.yaml index 9c73175..2447e16 100644 --- a/sliver-c2/playbook.yaml +++ b/sliver-c2/playbook.yaml @@ -6,6 +6,7 @@ - vars/sliver.yaml tasks: - import_tasks: tasks/apt_packages.yaml + - import_tasks: tasks/golang_install.yaml - import_tasks: tasks/harden.yaml - import_tasks: tasks/sliver_install.yaml - import_tasks: tasks/sliver_systemd.yaml diff --git a/sliver-c2/tasks/golang_install.yaml b/sliver-c2/tasks/golang_install.yaml new file mode 100644 index 0000000..e67d508 --- /dev/null +++ b/sliver-c2/tasks/golang_install.yaml @@ -0,0 +1,33 @@ +- name: download and extract golang + block: + - name: get latest golang version + shell: | + curl -sSL https://golang.org/dl/ | awk -F '"' '/dl\/.*linux-amd64.*tar.gz/{print $(NF-1)}' | awk -F '/' '{print $3}' | head -1 + register: latest_golang + changed_when: false + + - name: download golang + get_url: + url: "https://golang.org/dl/{{ latest_golang.stdout }}" + dest: /tmp/golang.tar.gz + + - name: extract golang to /usr/local + unarchive: + src: /tmp/golang.tar.gz + dest: /usr/local + remote_src: yes + + - name: remove tarball + file: + path: /tmp/golang.tar.gz + state: absent + + - 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' |