Files
ansible_role_package/tasks/archive/go.yml
Matthew Stobbs cf1c39ed84 always do go install
- need to figure out how to fix go install
2025-03-02 10:52:28 -07:00

43 lines
1.3 KiB
YAML

# vim: set filetype=yaml.ansible :
---
# - name: Check if go is already installed
# ansible.builtin.stat:
# path: "{{ path.go }}/VERSION"
# register: stat_path_go
#
# - name: Check version of installed go
# when:
# - stat_path_go.stat.exists
# ansible.builtin.set_fact:
# do_go_install: "{{ not (go.vers in lookup('ansible.builtin.file', path.go ~ '/VERSION')) }}"
- name: Install/update go
# when:
# - (do_go_install is defined and do_go_install) or
# not stat_path_go.stat.exists
block:
- 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 }}"