zuul-jobs/roles/ensure-go/tasks/main.yaml
Albin Vass fff6843da0 go: Use 'block: ... always: ...' and failed_when instead of ignore_errors
Change-Id: I11fc6ec69eda00f4ac824f27712acc82ec445f79
2020-04-28 16:20:20 +02:00

15 lines
610 B
YAML

- name: Check installed go version
command: go version
register: go_installed_version
environment:
PATH: "{{ ansible_env.PATH }}:{{ go_install_dir }}/go/bin"
failed_when: false
- name: Skip if correct version of go is installed
include_tasks: install-go.yaml
when:
- go_installed_version.rc != 0 or
go_version != (go_installed_version.stdout|regex_replace(go_version_pattern, '\\g<version>')) or
go_os != (go_installed_version.stdout|regex_replace(go_version_pattern, '\\g<os>')) or
go_arch != (go_installed_version.stdout|regex_replace(go_version_pattern, '\\g<arch>'))