From 10ef523fc9321cc725912342caaa5bd0fd04231e Mon Sep 17 00:00:00 2001 From: Matthew Stobbs Date: Sun, 23 Mar 2025 06:34:13 -0600 Subject: [PATCH] fix go install check --- tasks/archive/go.yml | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/tasks/archive/go.yml b/tasks/archive/go.yml index 79ee240..a0a2953 100644 --- a/tasks/archive/go.yml +++ b/tasks/archive/go.yml @@ -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 - ansible.builtin.set_fact: - do_go_install: "{{ not (go.vers in lookup('ansible.builtin.file', path.go ~ '/VERSION')) }}" + 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: + 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: