Unable to run command using Sudo in Ansible Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!How to switch a user per task or set of tasks?What user will Ansible run my commands as?SSH Agent Forwarding with AnsibleAnsible: have sudo but no rootNot able to become a different sudo user using ansible in GCEUsing Ansible to run sudo /bin/su - usernameHow to achieve sudo su - root and run all command in ansibleUser with sudo access cannot run sudo commands from Ansible AWX, with error “Missing Sudo Password”Ansible Playbook freezes on running a remote shell script having sudoAnsible become-method=pmrun failing
NERDTreeMenu Remapping
Can an iPhone 7 be made to function as a NFC Tag?
Did any compiler fully use 80-bit floating point?
Trying to understand entropy as a novice in thermodynamics
What initially awakened the Balrog?
Did pre-Columbian Americans know the spherical shape of the Earth?
One-one communication
In musical terms, what properties are varied by the human voice to produce different words / syllables?
AppleTVs create a chatty alternate WiFi network
The Nth Gryphon Number
Printing attributes of selection in ArcPy?
Project Euler #1 in C++
Can two people see the same photon?
How to ask rejected full-time candidates to apply to teach individual courses?
Would color changing eyes affect vision?
Weaponising the Grasp-at-a-Distance spell
Caught masturbating at work
Can you force honesty by using the Speak with Dead and Zone of Truth spells together?
I can't produce songs
What does 丫 mean? 丫是什么意思?
Where is the Next Backup Size entry on iOS 12?
Getting out of while loop on console
Tannaka duality for semisimple groups
Why not send Voyager 3 and 4 following up the paths taken by Voyager 1 and 2 to re-transmit signals of later as they fly away from Earth?
Unable to run command using Sudo in Ansible
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern)
Data science time! April 2019 and salary with experience
The Ask Question Wizard is Live!How to switch a user per task or set of tasks?What user will Ansible run my commands as?SSH Agent Forwarding with AnsibleAnsible: have sudo but no rootNot able to become a different sudo user using ansible in GCEUsing Ansible to run sudo /bin/su - usernameHow to achieve sudo su - root and run all command in ansibleUser with sudo access cannot run sudo commands from Ansible AWX, with error “Missing Sudo Password”Ansible Playbook freezes on running a remote shell script having sudoAnsible become-method=pmrun failing
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I’m running an Ansible job wherein I’m switching the user to a Service Account to run a certain command. I am able to switch the user and confirm the same using the become method and then a raw: whoami.
When in the same scenario post the become method, I’m trying to run the below command,
shell: java -version
it says java command not found. The Service Account does have the privilege of running this command on the server and I’m able to successfully run the same directly from the server.
Could anyone tell me what could be done here?
Thanks in Advance.
ansible ansible-2.x ansible-template ansible-role ansible-tower
add a comment |
I’m running an Ansible job wherein I’m switching the user to a Service Account to run a certain command. I am able to switch the user and confirm the same using the become method and then a raw: whoami.
When in the same scenario post the become method, I’m trying to run the below command,
shell: java -version
it says java command not found. The Service Account does have the privilege of running this command on the server and I’m able to successfully run the same directly from the server.
Could anyone tell me what could be done here?
Thanks in Advance.
ansible ansible-2.x ansible-template ansible-role ansible-tower
1
This generally occurs when the path of the java binary is not available when the command was executed
– error404
Mar 22 at 15:38
1
Specify the full path (generally a good idea), or set $PATH for that user accordingly to include "java".
– A. Scherbaum
Mar 23 at 0:44
Thank you all. Specifying the path resolved the issue.
– newtocoding
Mar 25 at 8:35
add a comment |
I’m running an Ansible job wherein I’m switching the user to a Service Account to run a certain command. I am able to switch the user and confirm the same using the become method and then a raw: whoami.
When in the same scenario post the become method, I’m trying to run the below command,
shell: java -version
it says java command not found. The Service Account does have the privilege of running this command on the server and I’m able to successfully run the same directly from the server.
Could anyone tell me what could be done here?
Thanks in Advance.
ansible ansible-2.x ansible-template ansible-role ansible-tower
I’m running an Ansible job wherein I’m switching the user to a Service Account to run a certain command. I am able to switch the user and confirm the same using the become method and then a raw: whoami.
When in the same scenario post the become method, I’m trying to run the below command,
shell: java -version
it says java command not found. The Service Account does have the privilege of running this command on the server and I’m able to successfully run the same directly from the server.
Could anyone tell me what could be done here?
Thanks in Advance.
ansible ansible-2.x ansible-template ansible-role ansible-tower
ansible ansible-2.x ansible-template ansible-role ansible-tower
asked Mar 22 at 11:50
newtocodingnewtocoding
398
398
1
This generally occurs when the path of the java binary is not available when the command was executed
– error404
Mar 22 at 15:38
1
Specify the full path (generally a good idea), or set $PATH for that user accordingly to include "java".
– A. Scherbaum
Mar 23 at 0:44
Thank you all. Specifying the path resolved the issue.
– newtocoding
Mar 25 at 8:35
add a comment |
1
This generally occurs when the path of the java binary is not available when the command was executed
– error404
Mar 22 at 15:38
1
Specify the full path (generally a good idea), or set $PATH for that user accordingly to include "java".
– A. Scherbaum
Mar 23 at 0:44
Thank you all. Specifying the path resolved the issue.
– newtocoding
Mar 25 at 8:35
1
1
This generally occurs when the path of the java binary is not available when the command was executed
– error404
Mar 22 at 15:38
This generally occurs when the path of the java binary is not available when the command was executed
– error404
Mar 22 at 15:38
1
1
Specify the full path (generally a good idea), or set $PATH for that user accordingly to include "java".
– A. Scherbaum
Mar 23 at 0:44
Specify the full path (generally a good idea), or set $PATH for that user accordingly to include "java".
– A. Scherbaum
Mar 23 at 0:44
Thank you all. Specifying the path resolved the issue.
– newtocoding
Mar 25 at 8:35
Thank you all. Specifying the path resolved the issue.
– newtocoding
Mar 25 at 8:35
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55298998%2funable-to-run-command-using-sudo-in-ansible%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55298998%2funable-to-run-command-using-sudo-in-ansible%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
This generally occurs when the path of the java binary is not available when the command was executed
– error404
Mar 22 at 15:38
1
Specify the full path (generally a good idea), or set $PATH for that user accordingly to include "java".
– A. Scherbaum
Mar 23 at 0:44
Thank you all. Specifying the path resolved the issue.
– newtocoding
Mar 25 at 8:35