48 lines
1.4 KiB
YAML
48 lines
1.4 KiB
YAML
- name: Check if toolchain path is already present
|
|
stat:
|
|
path: "{{ go_toolchains_path }}/{{ go_toolchain_version }}"
|
|
register: toolchain
|
|
|
|
- name: Make sure toolchain path has correct permissions
|
|
file:
|
|
path: "{{ go_toolchains_path }}"
|
|
state: directory
|
|
owner: root
|
|
group: root
|
|
mode: 0755
|
|
when: toolchain.stat.exists == False
|
|
|
|
- name: Download toolchain tarball
|
|
get_url:
|
|
url: "{{ go_toolchain_url }}"
|
|
dest: "/tmp/{{ go_toolchain_archive }}"
|
|
checksum: "sha256:{{ go_toolchain_sha256 }}"
|
|
when: toolchain.stat.exists == False
|
|
|
|
- name: Unarchive toolchain tarball
|
|
unarchive:
|
|
src: "/tmp/{{ go_toolchain_archive }}"
|
|
dest: "{{ go_toolchains_path }}"
|
|
copy: no
|
|
when: toolchain.stat.exists == False
|
|
|
|
- name: Move extracted toolchain to the version folder
|
|
command: /bin/mv "{{ go_toolchains_path }}/go" "{{ go_toolchains_path }}/{{ go_toolchain_version }}"
|
|
args:
|
|
creates: "{{ go_toolchains_path }}/{{ go_toolchain_version }}"
|
|
when: toolchain.stat.exists == False
|
|
|
|
- name: Symlink the latest golang toolchain
|
|
file:
|
|
src: "{{ go_toolchains_path }}/{{ go_toolchain_version }}"
|
|
dest: "{{ go_toolchains_path }}/latest"
|
|
owner: root
|
|
group: root
|
|
state: link
|
|
|
|
- name: Make sure the downloaded tarball is removed
|
|
file:
|
|
path: "/tmp/{{ go_toolchain_archive }}"
|
|
state: absent
|
|
when: toolchain.stat.exists == False
|