Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not working when become: yes #204

Open
kristijorgji opened this issue Jun 19, 2021 · 2 comments
Open

Not working when become: yes #204

kristijorgji opened this issue Jun 19, 2021 · 2 comments

Comments

@kristijorgji
Copy link

The role is installing fine go binary after extracting to specified location.
Issue is that after I ssh into remote machine, and sudo su, go command is not available as root.

I can solve that by running manually in terminal

source /etc/profile.d/golang.sh
# go now will work

ansible --version ansible 2.10.10

Why is this happening and not working for root ?

When I ssh at machine ssh -i key ubuntu@someip" as ubuntu user (in ec2) i can run go commad, profile.d is loaded, but after sudo su` that does not work as root.
Then all other ansible scripts fail that use root user to use installed go for building code

@sebix
Copy link
Contributor

sebix commented Aug 22, 2022

Without knowing what operating system you are using and which shell and the contents of various files, it is hard to tell, what is different on your server for the root user.

But that is unrelated to this ansible role.

@electronick
Copy link

electronick commented Jun 13, 2023

The solution is to use sudo su - instead of sudo su or add source /etc/profile.d/golang.sh to ~/.bashrc of the user you're switching to as /etc/profile.d/* loads only for login shells.

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

No branches or pull requests

3 participants