Files
ansible_role_package/tasks/archive/go.yml
2025-03-02 11:06:01 -07:00

37 lines
1.0 KiB
YAML

# vim: set filetype=yaml.ansible :
---
- name: Install/update go
block:
- name: Remove existing go install
when:
- ansible_system == 'Linux'
become: true
ansible.builtin.file:
state: absent
path: "{{ path.go }}"
- name: Download go archive
register: get_url_go
ansible.builtin.get_url:
dest: "{{ d_tempdir.path }}/{{ go.archive }}"
url: "{{ go.base_url }}/{{ go.archive }}"
checksum: "{{ go.sum }}"
decompress: false
mode: '0644'
- name: Extract go package for Linux
become: "{{ ext_become }}"
when:
- ansible_system == 'Linux'
ansible.builtin.unarchive:
dest: "{{ go.prefix }}"
src: "{{ d_tempdir.path }}/{{ go.archive }}"
remote_src: true
- name: Install go macOS using pkg file
become: true
when:
- ansible_distribution == 'MacOSX'
ansible.builtin.command:
cmd: "installer -pkg {{ d_tempdir.path }}/{{ go.archive }} -target {{ go.prefix }}"