summaryrefslogtreecommitdiff
path: root/ansible/roles/rust-rustup/tasks/main.yml
blob: ceb4a6920e611df6ba465d05b02bf392f07662f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
- name: "install necessary packagers"
  apt:
    name:
      - build-essential
      - cmake
      - curl
- name: "install Rust toolchain using rustup"
  shell: |
    set -eu
    if command -v rustup > /dev/null
    then
        sudo -u {{ rust_rustup_user }} rustup update
    else
        curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > /tmp/rustup.sh
        sudo -u {{ rust_rustup_user }} -i sh /tmp/rustup.sh -y --no-modify-path
    fi
    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 {{ rust_rustup_user }} sh -c '. $HOME/.cargo/env && cargo install {{ rustup_cargo_install }}'