Sync from polyfloyd infra

This commit is contained in:
polyfloyd 2023-02-11 13:21:17 +01:00
parent 54cf00f552
commit 47c279411d
3 changed files with 14 additions and 44 deletions

View file

@ -14,9 +14,7 @@
state: present
- name: Fetch Go latest version
shell: "curl --silent --location https://go.dev/doc/devel/release | grep -Eo 'go[0-9]+(\\.[0-9]+)+' | sort -V | uniq | tail -1 | sed s/^go//"
args:
warn: false
shell: "curl --silent --location https://go.dev/dl/ | grep -Eo 'go[0-9]+(\\.[0-9]+)+.linux' | sort -V | uniq | tail -1 | sed s/^go// | sed s/\\.linux$//"
changed_when: false
register: go_latest_version_shell
@ -25,15 +23,19 @@
go_latest_version: "{{ go_latest_version_shell.stdout }}"
- name: Detect installed Go version
shell: "go version | grep -Po '\\d\\.\\d+(\\.\\d+)?' || echo none"
shell: "go version | grep --color=never -Po '\\d\\.\\d+(\\.\\d+)?' || echo none"
register: go_installed_version_shell
ignore_errors: true
changed_when: false
- name: Format Go version variable
set_fact:
go_installed_version: "{{ go_installed_version_shell.stdout }}"
- debug:
msg:
- "Latest Go version: {{ go_latest_version}}"
- "Installed Go version: {{ go_installed_version }}"
- name: Remove installed go
file:
state: absent