fix go install check
This commit is contained in:
@@ -5,16 +5,35 @@
|
|||||||
path: "{{ path.go }}/VERSION"
|
path: "{{ path.go }}/VERSION"
|
||||||
register: stat_path_go
|
register: stat_path_go
|
||||||
|
|
||||||
- name: Check version of installed go
|
- name: Check installed go version
|
||||||
when:
|
when:
|
||||||
- stat_path_go.stat.exists
|
- 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:
|
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
|
- name: Install/update go
|
||||||
when:
|
when:
|
||||||
- (do_go_install is defined and do_go_install) or
|
- not stat_path_go.stat.exists
|
||||||
not stat_path_go.stat.exists
|
|
||||||
block:
|
block:
|
||||||
- name: Remove existing go install
|
- name: Remove existing go install
|
||||||
when:
|
when:
|
||||||
|
|||||||
Reference in New Issue
Block a user