rust.yaml


- name: Playbook to install rust nightly
  become: true
  tasks:
    - name: Install build essentials
      apt:
        name: [ build-essential, libssl-dev ]

    - name: Check if rustup already exists.
      stat:
        path: /home/jbb/.cargo/bin/rustup
      register: rustup

    - name: Download rustup
      get_url:
        url: https://sh.rustup.rs
        dest: /tmp/rustup
        mode: "0777"
      when: not rustup.stat.exists

    - name: Installing rust nightly
      become_user: jbb
      command: /tmp/rustup --default-toolchain nightly -y
      when: not rustup.stat.exists
      args:
        creates: /home/jbb/.cargo/bin/cargo

    - name: Update rust
      become_user: jbb
      command: /home/jbb/.cargo/bin/rustup update
      when: rustup.stat.exists