fubarhouse / ansible-role-rust

Ansible role for installing the Rust programming language
MIT License
30 stars 13 forks source link

running rust role as a non-root user fails #15

Closed jkryl closed 5 years ago

jkryl commented 5 years ago

Maybe I'm missing something obvious, but I'm trying to install rust for ssh user which ansible is using to connect to the host and it fails when doing apt cache update:

TASK [fubarhouse.rust : Rust | Update apt cache] *******************************
fatal: [mayastor-dev]: FAILED! => {"changed": false, "msg": "Failed to lock apt for exclusive operation"}

If I run the role with "become: true" (root), then rust is installed for the root user and not for the one I want.

btw isn't the apt-cache update step completely useless when rust is installed using rustup script and not by the packaging system?

fubarhouse commented 5 years ago

@jkryl,

It's an interesting idea - I'll see if the role tests well without the task and get back to you.

edit: It's not completely useless - if curl is not installed then the role will fail. We could mark gcc and curl as requirements for the role. I could simply move those tasks for testing.

fubarhouse commented 5 years ago

@jkryl,

Could you please try the branch prevent-package-install?

It has extra logic to not include the package files when curl and gcc are already found, and it should accommodate what you're doing.

Let me know how it goes and I'll organise a PR.

jkryl commented 5 years ago

it works but I had to rewrite the condition as follows:

  when:
    - ansible_os_family == "Debian"
    - '"curl" not in rust_which_curl.stdout or "gcc" not in rust_which_gcc.stdout'

The form with parenthesis and "and" did not work for me. Thanks!

fubarhouse commented 5 years ago

I'll organise the change tonight for you, thanks for the feedback!

fubarhouse commented 5 years ago

The tests are beginning to pass so this should be merged tonight - they run for a while and there would be three: push, PR and merge. I'll update this one after it's merged.

fubarhouse commented 5 years ago

Would you like a point release for this one, or is there no urgency it to be included in a tag?

jkryl commented 5 years ago

no rush, it can wait. Thanks for all the work!