blob: 4c34eb811464f194ad95e7049e8ae5bfe3ba98da (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
---
- name: "Check installed rust version"
ansible.builtin.command:
cmd: "mise current rust"
register: rust_current_version
changed_when: false
failed_when: false
- name: "Install rust {{ rust_toolchain }}"
ansible.builtin.command:
cmd: "mise use --global rust@{{ rust_toolchain }}"
changed_when: true
when: rust_toolchain not in rust_current_version.stdout
- 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: "Remove cargo default shell profile modification"
ansible.builtin.lineinfile:
path: "{{ ansible_facts['env']['HOME'] }}/.bashrc"
line: '. "$HOME/.cargo/env"'
state: "absent"
- 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
|