--- - name: "Check installed rust versions" ansible.builtin.command: cmd: "mise ls rust" register: rust_installed_versions changed_when: false - name: "Install rust versions" ansible.builtin.command: cmd: "mise use --global rust@{{ item }}" changed_when: true when: item not in rust_installed_versions.stdout loop: "{{ rust_versions }}" - name: "Install rust components" ansible.builtin.command: cmd: "mise exec rust -- rustup component add {{ item }}" register: rust_component_result changed_when: "'is up to date' not in rust_component_result.stdout" loop: "{{ rust_components }}" - name: "Add cargo bin to shell profile" ansible.builtin.blockinfile: path: "{{ ansible_facts['env']['HOME'] }}/.bashrc" state: "present" prepend_newline: true append_newline: true marker: "# ==== {mark} ANSIBLE RUST CONFIG" block: | if [ -d "$HOME/.cargo/bin" ]; then export PATH="$HOME/.cargo/bin:$PATH" fi