fix go install check

This commit is contained in:
Matthew Stobbs
2025-03-23 06:34:13 -06:00
parent a55aa9ba19
commit 10ef523fc9

View File

@@ -5,16 +5,35 @@
path: "{{ path.go }}/VERSION"
register: stat_path_go
- name: Check version of installed go
- name: Check installed go version
when:
- stat_path_go.stat.exists
block:
- name: Get installed version
register: r_go_version
ansible.builtin.command:
argv:
- "{{ path.go }}/bin/go"
- version
- name: Check if go needs updating
when:
- r_go_version.rc|int == 0
ansible.builtin.set_fact:
do_go_install: "{{ not (go.vers in lookup('ansible.builtin.file', path.go ~ '/VERSION')) }}"
go_do_update: "{{ go.vers in r_go_version.stdout }}"
- name: Dump vars
block:
- debug:
var: stat_path_go
- debug:
var: r_go_version
- debug:
var: go_do_update
- name: Install/update go
when:
- (do_go_install is defined and do_go_install) or
not stat_path_go.stat.exists
- not stat_path_go.stat.exists
block:
- name: Remove existing go install
when: