Files
ansible_role_package/tasks/archive/go.yml
2025-02-12 16:57:28 -07:00

45 lines
1.2 KiB
YAML

# vim: set filetype=yaml.ansible :
---
- name: Check if archive already exists
ansible.builtin.stat:
path: "{{ paths.archive }}/{{ go_archive }}"
register: stat_go_archive
- name: Install/update go
when:
- not stat_go_archive.exists
block:
- name: Download go archive
become: "{{ sys_pkg_become }}"
ansible.builtin.get_url:
dest: "{{ paths.cache }}/{{ go_archive }}"
url: "{{ go.url }}"
checksum: "{{ go.sum }}"
decompress: false
mode: '0644'
register: get_url_go
- name: Ensure go install dir exists
become: "{{ sys_pkg_become }}"
ansible.builtin.file:
path: "{{ go.inst_path }}"
state: directory
mode: '0755'
- name: Extract go package
become: "{{ sys_pkg_become }}"
when:
- ansible_system == 'Linux'
ansible.builtin.unarchive:
dest: "{{ paths.archive }}/go"
src: "{{ d_go_dl_tmp.path }}/{{ go_archive }}"
remote_src: true
- name: Install go macOS use pkg file
become: true
when:
- ansible_system == 'Darwin'
ansible.builtin.command:
creates: "{{ go.inst_path }}"
cmd: "installer -pkg {{ d_go_dl_tmp.path }}/{{ go_archive }} -target /"