Fix building rust crates via separate user

This commit is contained in:
2021-10-31 13:09:00 +01:00
parent b4fdaae8c5
commit ff9d2b547f

View File

@@ -394,13 +394,21 @@
system: true system: true
become: true become: true
- name: install rustup on ubuntu
shell: curl https://sh.rustup.rs -sSf | sh -s -- -y
args:
creates: /var/lib/rust_build/.cargo/bin/rustup
become: true
become_user: rust_build
when: distro == 'ubuntu'
- name: add rustup stable toolchain - name: add rustup stable toolchain
command: rustup default stable shell: . ~/.cargo/env && rustup default stable
become: true become: true
become_user: rust_build become_user: rust_build
- name: update rustup stable toolchain - name: update rustup stable toolchain
command: rustup update stable shell: . ~/.cargo/env && rustup update stable
become: true become: true
become_user: rust_build become_user: rust_build
@@ -428,6 +436,8 @@
- name: build rust crates - name: build rust crates
shell: | shell: |
set -o errexit
. ~/.cargo/env
cargo install --version {{ item.version }} {{ item.crate }} cargo install --version {{ item.version }} {{ item.crate }}
mv /var/lib/rust_build/.cargo/bin/{{ item. binary }} /var/lib/rust_build/.cargo/bin/{{ item.binary }}.{{ item.version }} mv /var/lib/rust_build/.cargo/bin/{{ item. binary }} /var/lib/rust_build/.cargo/bin/{{ item.binary }}.{{ item.version }}
args: args: