Skip to content
This repository has been archived by the owner on Dec 28, 2024. It is now read-only.

var ansible_user_id is always root #43

Open
g-hengeli opened this issue Aug 27, 2015 · 5 comments
Open

var ansible_user_id is always root #43

g-hengeli opened this issue Aug 27, 2015 · 5 comments

Comments

@g-hengeli
Copy link

I'm trying to configure the shell for my user with the user module

- name: Set as default shell
  user: name={{ ansible_user_id }} shell=/bin/zsh

When doing this it treats ansible_user_id as root. I want to set the shell for my current user, not root. I have tried specifically saying sudo=no and no luck.

This also straight up fails when doing it from a role.

@bborysenko
Copy link

It's due to fact that become hardcoded to True:

https://github.com/spencergibb/battleschool/blob/master/lib/battleschool/main.py#L231

@kforsthoevel
Copy link

Have you tried name={{ lookup('env','USER') }}?

@spencergibb
Copy link
Owner

See this group thread.

The way around this is to run with battle --ask-sudo-pass. This is how I run by default.

@spencergibb
Copy link
Owner

@ghengeli does name={{ lookup('env','USER') }} work for you?

@g-hengeli
Copy link
Author

@spencergibb That does work. Thank you for following up! Good work on the project. I like it a lot.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants