diff options
| -rw-r--r-- | group_vars/all.yml | bin | 4586 -> 4565 bytes | |||
| -rw-r--r-- | host_vars/archlinux.local.yml | bin | 1188 -> 1209 bytes | |||
| -rw-r--r-- | host_vars/archlinux.local.yml.example | 1 | ||||
| -rw-r--r-- | host_vars/mac.local.yml | bin | 1016 -> 1037 bytes | |||
| -rw-r--r-- | roles/go/defaults/main.yml | 2 | ||||
| -rw-r--r-- | roles/go/meta/argument_specs.yml | 2 | ||||
| -rw-r--r-- | roles/go/meta/main.yml | 4 | ||||
| -rw-r--r-- | roles/go/tasks/main.yml | 36 |
8 files changed, 15 insertions, 30 deletions
diff --git a/group_vars/all.yml b/group_vars/all.yml Binary files differindex 113cf50d..70232d76 100644 --- a/group_vars/all.yml +++ b/group_vars/all.yml diff --git a/host_vars/archlinux.local.yml b/host_vars/archlinux.local.yml Binary files differindex 7b671da3..111991e3 100644 --- a/host_vars/archlinux.local.yml +++ b/host_vars/archlinux.local.yml diff --git a/host_vars/archlinux.local.yml.example b/host_vars/archlinux.local.yml.example index 1d583686..f6f4ce5e 100644 --- a/host_vars/archlinux.local.yml.example +++ b/host_vars/archlinux.local.yml.example @@ -7,6 +7,7 @@ network_ipv6_address: "fd5c:fd8b:2b8c::201/64" network_ipv6_gateway: "fd5c:fd8b:2b8c::254" network_ipv6_dns: "fd5c:fd8b:2b8c::254" +go_version: "1.25.3" python_versions: - "3.13.7" - "3.12.11" diff --git a/host_vars/mac.local.yml b/host_vars/mac.local.yml Binary files differindex f9364089..8d0366f4 100644 --- a/host_vars/mac.local.yml +++ b/host_vars/mac.local.yml diff --git a/roles/go/defaults/main.yml b/roles/go/defaults/main.yml index 16cbca2d..67bb55f2 100644 --- a/roles/go/defaults/main.yml +++ b/roles/go/defaults/main.yml @@ -1,2 +1,2 @@ --- -go_version: "1.25.3" +go_version: "latest" diff --git a/roles/go/meta/argument_specs.yml b/roles/go/meta/argument_specs.yml index 9943134f..3e518135 100644 --- a/roles/go/meta/argument_specs.yml +++ b/roles/go/meta/argument_specs.yml @@ -7,4 +7,4 @@ argument_specs: go_version: type: "str" description: "Default go version to install" - default: "1.25.3" + default: "latest" diff --git a/roles/go/meta/main.yml b/roles/go/meta/main.yml index d96d4509..9990d138 100644 --- a/roles/go/meta/main.yml +++ b/roles/go/meta/main.yml @@ -1,9 +1,9 @@ --- dependencies: - - role: "bash" + - role: "mise" galaxy_info: author: "a14m" - description: "Install Go (versions) on Linux distributions" + description: "Install Go via mise on Linux distributions" license: "MIT" min_ansible_version: "2.18" platforms: diff --git a/roles/go/tasks/main.yml b/roles/go/tasks/main.yml index 93ec8a3a..fbf6e688 100644 --- a/roles/go/tasks/main.yml +++ b/roles/go/tasks/main.yml @@ -1,33 +1,18 @@ --- -- name: "Check installed go versions" +- name: "Check installed go version" ansible.builtin.command: - cmd: "/usr/local/go/bin/go version" - register: go_installed_version + cmd: "mise current go" + register: go_current_version changed_when: false failed_when: false -- name: "Install go" - when: go_version not in go_installed_version.stdout - block: - - name: "Set go facts" - ansible.builtin.set_fact: - go_arch: "{{ 'amd64' if ansible_facts['architecture'] == 'x86_64' else 'arm64' }}" - go_platform: "{{ ansible_facts['system'] | lower }}" - - - name: "Download Go" - ansible.builtin.get_url: - url: "https://dl.google.com/go/go{{ go_version }}.{{ go_platform }}-{{ go_arch }}.tar.gz" - dest: "/tmp/go.tar.gz" - mode: "0644" - - - name: "Unarchive Go" - become: true - ansible.builtin.unarchive: - src: "/tmp/go.tar.gz" - dest: "/usr/local" - remote_src: true +- name: "Install go {{ go_version }}" + ansible.builtin.command: + cmd: "mise use --global go@{{ go_version }}" + changed_when: true + when: go_version not in go_current_version.stdout -- name: "Add Go to shell profile" +- name: "Add Go bin to shell profile" ansible.builtin.blockinfile: path: "{{ ansible_facts['env']['HOME'] }}/.bashrc" state: "present" @@ -35,7 +20,6 @@ append_newline: true marker: "# ==== {mark} ANSIBLE GO CONFIG" block: | - if command -v go 1>/dev/null 2>&1; then - export PATH="$PATH:/usr/local/go/bin" + if [ -d "$HOME/go/bin" ]; then export PATH="$HOME/go/bin:$PATH" fi |
