diff options
author | Lars Wirzenius <liw@liw.fi> | 2024-02-13 18:27:40 +0200 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2024-02-13 18:27:40 +0200 |
commit | 96239c08f23f346bf81af95ab044f1d8238fb8f4 (patch) | |
tree | 36f1d73c4477bb8b1f3ea0bac9902c4222cdd0b7 | |
parent | 620ca63916480ce33755928cc6069a05c9b5db4d (diff) | |
download | ansibleness-96239c08f23f346bf81af95ab044f1d8238fb8f4.tar.gz |
rust-rustup: add variable for user for whom to install Rust
Signed-off-by: Lars Wirzenius <liw@liw.fi>
Sponsored-by: author
-rw-r--r-- | ansible/roles/rust-rustup/defaults/main.yml | 1 | ||||
-rw-r--r-- | ansible/roles/rust-rustup/tasks/main.yml | 10 |
2 files changed, 6 insertions, 5 deletions
diff --git a/ansible/roles/rust-rustup/defaults/main.yml b/ansible/roles/rust-rustup/defaults/main.yml new file mode 100644 index 0000000..e1c0df8 --- /dev/null +++ b/ansible/roles/rust-rustup/defaults/main.yml @@ -0,0 +1 @@ +rust_rustup_user: liw diff --git a/ansible/roles/rust-rustup/tasks/main.yml b/ansible/roles/rust-rustup/tasks/main.yml index c97aca2..ceb4a69 100644 --- a/ansible/roles/rust-rustup/tasks/main.yml +++ b/ansible/roles/rust-rustup/tasks/main.yml @@ -9,16 +9,16 @@ set -eu if command -v rustup > /dev/null then - sudo -u liw rustup update + sudo -u {{ rust_rustup_user }} rustup update else curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > /tmp/rustup.sh - sudo -u liw -i sh /tmp/rustup.sh -y --no-modify-path + sudo -u {{ rust_rustup_user }} -i sh /tmp/rustup.sh -y --no-modify-path fi - sudo -u liw -i /home/liw/.cargo/bin/rustup self update - sudo -u liw -i /home/liw/.cargo/bin/rustup component add clippy \ + sudo -u {{ rust_rustup_user }} -i /home/{{ rust_rustup_user }}/.cargo/bin/rustup self update + sudo -u {{ rust_rustup_user }} -i /home/{{ rust_rustup_user }}/.cargo/bin/rustup component add clippy \ rust-src rust-analyzer - name: "cargo install applications" when: rustup_cargo_install is defined shell: | - sudo -i -u liw sh -c '. $HOME/.cargo/env && cargo install {{ rustup_cargo_install }}' + sudo -i -u {{ rust_rustup_user }} sh -c '. $HOME/.cargo/env && cargo install {{ rustup_cargo_install }}' |