From 2f427676c56f9b8d107cc49072fff994623ad3ef Mon Sep 17 00:00:00 2001 From: Marc Cataford Date: Sun, 29 Sep 2024 13:46:55 -0400 Subject: [PATCH] feat: add rustup + go --- home.yml | 1 + roles/dev-toolchain/tasks/main.yml | 17 +++++++++++++++++ roles/dev-toolchain/vars/main.yml | 2 ++ 3 files changed, 20 insertions(+) create mode 100644 roles/dev-toolchain/tasks/main.yml create mode 100644 roles/dev-toolchain/vars/main.yml diff --git a/home.yml b/home.yml index b319cdf..a3f1eaf 100644 --- a/home.yml +++ b/home.yml @@ -3,6 +3,7 @@ hosts: localhost roles: - system-packages + - dev-toolchain - shell-tweaks - editor-tweaks - tool-config diff --git a/roles/dev-toolchain/tasks/main.yml b/roles/dev-toolchain/tasks/main.yml new file mode 100644 index 0000000..9c8d2fd --- /dev/null +++ b/roles/dev-toolchain/tasks/main.yml @@ -0,0 +1,17 @@ +--- +- name: Check if rustup is installed + shell: which rustup + register: which_rustup +- name: Install rustup + shell: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + when: which_rustup.rc == 1 +- name: Check if go is installed + shell: go version + register: check_go_version +- name: Install go + become: true + shell: | + curl -o /tmp/go.tar.gz -L https://go.dev/dl/go{{go_version}}.linux-amd64.tar.gz && + rm -rf /usr/local/go && + sudo tar -C /usr/local -xzf /tmp/go.tar.gz + when: check_go_version.rc == 1 or check_go_version.stdout.find(go_version) == -1 diff --git a/roles/dev-toolchain/vars/main.yml b/roles/dev-toolchain/vars/main.yml new file mode 100644 index 0000000..b470603 --- /dev/null +++ b/roles/dev-toolchain/vars/main.yml @@ -0,0 +1,2 @@ +--- +go_version: 1.23.1