Skip to content

Commit e97c64f

Browse files
committed
Improve installing Rust on dev-desktops
The previous iteration of the installation task executed an inline Bash script that was hard to debug. A better approach is to execute the individual steps of the script as separate Ansible tasks.
1 parent 703a0e6 commit e97c64f

File tree

2 files changed

+16
-9
lines changed

2 files changed

+16
-9
lines changed

ansible/roles/dev-desktop/defaults/main.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
---
2+
vars_rustup_version: "1.24.1"
3+
vars_rustup_checksum: "a3cb081f88a6789d104518b30d4aa410009cd08c3822a1226991d6cf0442a0f8"
24

35
vars_team_login_path: "/root/team_login"
46
allow_ssh_extra_groups: "dev-desktop-allow-ssh"

ansible/roles/dev-desktop/tasks/dependencies.yml

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -115,15 +115,20 @@
115115
- linux-image-extra-virtual
116116
when: kernel_flavor.stdout == "generic"
117117

118-
- name: Install rustup in userspace for root
119-
shell: |
120-
set -eu
121-
RUSTUP_VERSION=1.24.3
122-
RUSTUP_SHA="a3cb081f88a6789d104518b30d4aa410009cd08c3822a1226991d6cf0442a0f8"
123-
curl --proto '=https' --tlsv1.2 -sSf -O \
124-
https://raw.githubusercontent.com/rust-lang/rustup/${RUSTUP_VERSION}/rustup-init.sh
125-
echo "${RUSTUP_SHA} rustup-init.sh" | sha256sum --check --
126-
sh rustup-init.sh --default-toolchain nightly -y --component rust-src
118+
- name: Download Rustup installer
119+
ansible.builtin.get_url:
120+
url: "https://raw.githubusercontent.com/rust-lang/rustup/{{ vars_rustup_version }}/rustup-init.sh"
121+
dest: /tmp/rustup-init.sh
122+
mode: 0744
123+
checksum: "sha256:{{ vars_rustup_checksum }}"
124+
125+
- name: Install Rustup in userspace for root
126+
ansible.builtin.command: /tmp/rustup-init.sh --default-toolchain nightly -y --component rust-src
127+
128+
- name: Clean up Rustup installer
129+
ansible.builtin.file:
130+
path: /tmp/rustup-init.sh
131+
state: absent
127132

128133
- name: Check if Node is installed
129134
command: node --version

0 commit comments

Comments
 (0)