You need to be root to execute - ansibleAnsible sudo does not workAnsible cannot make dir /$HOME/.ansible/cpReload PATH for the entire playbookansible playbook: setup and connect to docker (authentication or permission failure)getting MODULE FAILURE error with pipelining = True in ansibleAnsible : You should rebuild using libgmp >= 5 to avoid timing attack vulnerabilityyum distro-sync on ansibleAnsible service task fails with “Could not find the requested service XXX”Installing package via Ansible using a user with limited sudo rightsRun Same Ansible Playbook for Different Local Users

How can a jailer prevent the Forge Cleric's Artisan's Blessing from being used?

node command while defining a coordinate in TikZ

Installing PowerShell on 32-bit Kali OS fails

Lightning Web Component - do I need to track changes for every single input field in a form

What does the "3am" section means in manpages?

Simple recursive Sudoku solver

Can I use my Chinese passport to enter China after I acquired another citizenship?

Golf game boilerplate

Is there an Impartial Brexit Deal comparison site?

Pronouncing Homer as in modern Greek

Why are on-board computers allowed to change controls without notifying the pilots?

A workplace installs custom certificates on personal devices, can this be used to decrypt HTTPS traffic?

Is a naturally all "male" species possible?

In Star Trek IV, why did the Bounty go back to a time when whales were already rare?

Teaching indefinite integrals that require special-casing

What (else) happened July 1st 1858 in London?

I'm in charge of equipment buying but no one's ever happy with what I choose. How to fix this?

Can a Bard use an arcane focus?

How do I repair my stair bannister?

What do you call the infoboxes with text and sometimes images on the side of a page we find in textbooks?

Can a Gentile theist be saved?

Java - What do constructor type arguments mean when placed *before* the type?

Simulating a probability of 1 of 2^N with less than N random bits

Can I rely on these GitHub repository files?



You need to be root to execute - ansible


Ansible sudo does not workAnsible cannot make dir /$HOME/.ansible/cpReload PATH for the entire playbookansible playbook: setup and connect to docker (authentication or permission failure)getting MODULE FAILURE error with pipelining = True in ansibleAnsible : You should rebuild using libgmp >= 5 to avoid timing attack vulnerabilityyum distro-sync on ansibleAnsible service task fails with “Could not find the requested service XXX”Installing package via Ansible using a user with limited sudo rightsRun Same Ansible Playbook for Different Local Users













1















I have a lab setup with ansible controller + node and exploring few areas.



I am so far setup an user account named ansible in both machines and enabled ssh keybased authentication



Also setup sudo premissions for the user in both machines



When I try to run the below playbook , It works on the local machine and fails on the other node.



--- #Install Telnet
- hosts: all
name: Install Telnet
become: true
become_user: ansible
become_method: sudo
tasks:
- yum:
name: telnet
state: latest



Output is as follows
`[ansible@host1 playbooks]$ ansible-playbook telnetDeployYUM.yml



PLAY [Install Telnet] ***********************************************************************************************************************************************************************



TASK [Gathering Facts] **********************************************************************************************************************************************************************
ok: [192.168.64.6]
ok: [192.168.64.5]



TASK [yum] **********************************************************************************************************************************************************************************
ok: [192.168.64.5]
fatal: [192.168.64.6]: FAILED! => "changed": true, "msg": "You need to be root to perform this command.n", "obsoletes": "grub2": "dist": "x86_64", "repo": "@anaconda", "version": "1:2.02-0.64.el7.centos", "grub2-tools": "dist": "x86_64", "repo": "@anaconda", "version": "1:2.02-0.64.el7.centos", "rc": 1, "results": ["Loaded plugins: fastestmirrorn"]
to retry, use: --limit @/home/ansible/playbooks/telnetDeployYUM.retry



PLAY RECAP **********************************************************************************************************************************************************************************
192.168.64.5 : ok=2 changed=0 unreachable=0 failed=0
192.168.64.6 : ok=1 changed=0 unreachable=0 failed=1



[ansible@host1 playbooks]$
`



I could also manually able to run sudo yum on the failed target as ansible user



I believe sudo set up in correct



[ansible@host2 root]$ sudo whoami
root



Can experts share some insights on what I am missing with respect to my failed machine , Thanks.










share|improve this question


























    1















    I have a lab setup with ansible controller + node and exploring few areas.



    I am so far setup an user account named ansible in both machines and enabled ssh keybased authentication



    Also setup sudo premissions for the user in both machines



    When I try to run the below playbook , It works on the local machine and fails on the other node.



    --- #Install Telnet
    - hosts: all
    name: Install Telnet
    become: true
    become_user: ansible
    become_method: sudo
    tasks:
    - yum:
    name: telnet
    state: latest



    Output is as follows
    `[ansible@host1 playbooks]$ ansible-playbook telnetDeployYUM.yml



    PLAY [Install Telnet] ***********************************************************************************************************************************************************************



    TASK [Gathering Facts] **********************************************************************************************************************************************************************
    ok: [192.168.64.6]
    ok: [192.168.64.5]



    TASK [yum] **********************************************************************************************************************************************************************************
    ok: [192.168.64.5]
    fatal: [192.168.64.6]: FAILED! => "changed": true, "msg": "You need to be root to perform this command.n", "obsoletes": "grub2": "dist": "x86_64", "repo": "@anaconda", "version": "1:2.02-0.64.el7.centos", "grub2-tools": "dist": "x86_64", "repo": "@anaconda", "version": "1:2.02-0.64.el7.centos", "rc": 1, "results": ["Loaded plugins: fastestmirrorn"]
    to retry, use: --limit @/home/ansible/playbooks/telnetDeployYUM.retry



    PLAY RECAP **********************************************************************************************************************************************************************************
    192.168.64.5 : ok=2 changed=0 unreachable=0 failed=0
    192.168.64.6 : ok=1 changed=0 unreachable=0 failed=1



    [ansible@host1 playbooks]$
    `



    I could also manually able to run sudo yum on the failed target as ansible user



    I believe sudo set up in correct



    [ansible@host2 root]$ sudo whoami
    root



    Can experts share some insights on what I am missing with respect to my failed machine , Thanks.










    share|improve this question
























      1












      1








      1








      I have a lab setup with ansible controller + node and exploring few areas.



      I am so far setup an user account named ansible in both machines and enabled ssh keybased authentication



      Also setup sudo premissions for the user in both machines



      When I try to run the below playbook , It works on the local machine and fails on the other node.



      --- #Install Telnet
      - hosts: all
      name: Install Telnet
      become: true
      become_user: ansible
      become_method: sudo
      tasks:
      - yum:
      name: telnet
      state: latest



      Output is as follows
      `[ansible@host1 playbooks]$ ansible-playbook telnetDeployYUM.yml



      PLAY [Install Telnet] ***********************************************************************************************************************************************************************



      TASK [Gathering Facts] **********************************************************************************************************************************************************************
      ok: [192.168.64.6]
      ok: [192.168.64.5]



      TASK [yum] **********************************************************************************************************************************************************************************
      ok: [192.168.64.5]
      fatal: [192.168.64.6]: FAILED! => "changed": true, "msg": "You need to be root to perform this command.n", "obsoletes": "grub2": "dist": "x86_64", "repo": "@anaconda", "version": "1:2.02-0.64.el7.centos", "grub2-tools": "dist": "x86_64", "repo": "@anaconda", "version": "1:2.02-0.64.el7.centos", "rc": 1, "results": ["Loaded plugins: fastestmirrorn"]
      to retry, use: --limit @/home/ansible/playbooks/telnetDeployYUM.retry



      PLAY RECAP **********************************************************************************************************************************************************************************
      192.168.64.5 : ok=2 changed=0 unreachable=0 failed=0
      192.168.64.6 : ok=1 changed=0 unreachable=0 failed=1



      [ansible@host1 playbooks]$
      `



      I could also manually able to run sudo yum on the failed target as ansible user



      I believe sudo set up in correct



      [ansible@host2 root]$ sudo whoami
      root



      Can experts share some insights on what I am missing with respect to my failed machine , Thanks.










      share|improve this question














      I have a lab setup with ansible controller + node and exploring few areas.



      I am so far setup an user account named ansible in both machines and enabled ssh keybased authentication



      Also setup sudo premissions for the user in both machines



      When I try to run the below playbook , It works on the local machine and fails on the other node.



      --- #Install Telnet
      - hosts: all
      name: Install Telnet
      become: true
      become_user: ansible
      become_method: sudo
      tasks:
      - yum:
      name: telnet
      state: latest



      Output is as follows
      `[ansible@host1 playbooks]$ ansible-playbook telnetDeployYUM.yml



      PLAY [Install Telnet] ***********************************************************************************************************************************************************************



      TASK [Gathering Facts] **********************************************************************************************************************************************************************
      ok: [192.168.64.6]
      ok: [192.168.64.5]



      TASK [yum] **********************************************************************************************************************************************************************************
      ok: [192.168.64.5]
      fatal: [192.168.64.6]: FAILED! => "changed": true, "msg": "You need to be root to perform this command.n", "obsoletes": "grub2": "dist": "x86_64", "repo": "@anaconda", "version": "1:2.02-0.64.el7.centos", "grub2-tools": "dist": "x86_64", "repo": "@anaconda", "version": "1:2.02-0.64.el7.centos", "rc": 1, "results": ["Loaded plugins: fastestmirrorn"]
      to retry, use: --limit @/home/ansible/playbooks/telnetDeployYUM.retry



      PLAY RECAP **********************************************************************************************************************************************************************************
      192.168.64.5 : ok=2 changed=0 unreachable=0 failed=0
      192.168.64.6 : ok=1 changed=0 unreachable=0 failed=1



      [ansible@host1 playbooks]$
      `



      I could also manually able to run sudo yum on the failed target as ansible user



      I believe sudo set up in correct



      [ansible@host2 root]$ sudo whoami
      root



      Can experts share some insights on what I am missing with respect to my failed machine , Thanks.







      ansible






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 8 at 8:02









      user2190101user2190101

      3433520




      3433520






















          2 Answers
          2






          active

          oldest

          votes


















          0














          Below should work fine



          - hosts: all
          name: Install Telnet
          become: yes
          tasks:
          - yum:
          name: telnet
          state: latest


          ansible or user through which ansible is getting executed should be in sudoers file.



          You are changing your user to ansible which is not required.






          share|improve this answer

























          • yes , thats correct. It was the mistake.

            – user2190101
            Mar 18 at 14:17


















          1














          Run with -vvvv to see what ansible is doing.



          Have you setup ansible in sudoers for password less privilege elevation?
          you are getting a message that it is waiting for "escalation prompt". That means when you are running with become, you are failing to become since it needs the password. Make sure your test user is in /etc/sudoers AND you have it marked for that user to NOT need to enter a password when running sudo commands. The entry should end with :NOPASSWD on the line in that file.






          share|improve this answer






















            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
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55058963%2fyou-need-to-be-root-to-execute-ansible%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            Below should work fine



            - hosts: all
            name: Install Telnet
            become: yes
            tasks:
            - yum:
            name: telnet
            state: latest


            ansible or user through which ansible is getting executed should be in sudoers file.



            You are changing your user to ansible which is not required.






            share|improve this answer

























            • yes , thats correct. It was the mistake.

              – user2190101
              Mar 18 at 14:17















            0














            Below should work fine



            - hosts: all
            name: Install Telnet
            become: yes
            tasks:
            - yum:
            name: telnet
            state: latest


            ansible or user through which ansible is getting executed should be in sudoers file.



            You are changing your user to ansible which is not required.






            share|improve this answer

























            • yes , thats correct. It was the mistake.

              – user2190101
              Mar 18 at 14:17













            0












            0








            0







            Below should work fine



            - hosts: all
            name: Install Telnet
            become: yes
            tasks:
            - yum:
            name: telnet
            state: latest


            ansible or user through which ansible is getting executed should be in sudoers file.



            You are changing your user to ansible which is not required.






            share|improve this answer















            Below should work fine



            - hosts: all
            name: Install Telnet
            become: yes
            tasks:
            - yum:
            name: telnet
            state: latest


            ansible or user through which ansible is getting executed should be in sudoers file.



            You are changing your user to ansible which is not required.







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Mar 18 at 15:31

























            answered Mar 8 at 13:21









            error404error404

            56958




            56958












            • yes , thats correct. It was the mistake.

              – user2190101
              Mar 18 at 14:17

















            • yes , thats correct. It was the mistake.

              – user2190101
              Mar 18 at 14:17
















            yes , thats correct. It was the mistake.

            – user2190101
            Mar 18 at 14:17





            yes , thats correct. It was the mistake.

            – user2190101
            Mar 18 at 14:17













            1














            Run with -vvvv to see what ansible is doing.



            Have you setup ansible in sudoers for password less privilege elevation?
            you are getting a message that it is waiting for "escalation prompt". That means when you are running with become, you are failing to become since it needs the password. Make sure your test user is in /etc/sudoers AND you have it marked for that user to NOT need to enter a password when running sudo commands. The entry should end with :NOPASSWD on the line in that file.






            share|improve this answer



























              1














              Run with -vvvv to see what ansible is doing.



              Have you setup ansible in sudoers for password less privilege elevation?
              you are getting a message that it is waiting for "escalation prompt". That means when you are running with become, you are failing to become since it needs the password. Make sure your test user is in /etc/sudoers AND you have it marked for that user to NOT need to enter a password when running sudo commands. The entry should end with :NOPASSWD on the line in that file.






              share|improve this answer

























                1












                1








                1







                Run with -vvvv to see what ansible is doing.



                Have you setup ansible in sudoers for password less privilege elevation?
                you are getting a message that it is waiting for "escalation prompt". That means when you are running with become, you are failing to become since it needs the password. Make sure your test user is in /etc/sudoers AND you have it marked for that user to NOT need to enter a password when running sudo commands. The entry should end with :NOPASSWD on the line in that file.






                share|improve this answer













                Run with -vvvv to see what ansible is doing.



                Have you setup ansible in sudoers for password less privilege elevation?
                you are getting a message that it is waiting for "escalation prompt". That means when you are running with become, you are failing to become since it needs the password. Make sure your test user is in /etc/sudoers AND you have it marked for that user to NOT need to enter a password when running sudo commands. The entry should end with :NOPASSWD on the line in that file.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Mar 8 at 9:06









                ferminx360ferminx360

                537




                537



























                    draft saved

                    draft discarded
















































                    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.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55058963%2fyou-need-to-be-root-to-execute-ansible%23new-answer', 'question_page');

                    );

                    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







                    Popular posts from this blog

                    Identity Server 4 is not redirecting to Angular app after login2019 Community Moderator ElectionIdentity Server 4 and dockerIdentityserver implicit flow unauthorized_clientIdentityServer Hybrid Flow - Access Token is null after user successful loginIdentity Server to MVC client : Page Redirect After loginLogin with Steam OpenId(oidc-client-js)Identity Server 4+.NET Core 2.0 + IdentityIdentityServer4 post-login redirect not working in Edge browserCall to IdentityServer4 generates System.NullReferenceException: Object reference not set to an instance of an objectIdentityServer4 without HTTPS not workingHow to get Authorization code from identity server without login form

                    2005 Ahvaz unrest Contents Background Causes Casualties Aftermath See also References Navigation menue"At Least 10 Are Killed by Bombs in Iran""Iran"Archived"Arab-Iranians in Iran to make April 15 'Day of Fury'"State of Mind, State of Order: Reactions to Ethnic Unrest in the Islamic Republic of Iran.10.1111/j.1754-9469.2008.00028.x"Iran hangs Arab separatists"Iran Overview from ArchivedConstitution of the Islamic Republic of Iran"Tehran puzzled by forged 'riots' letter""Iran and its minorities: Down in the second class""Iran: Handling Of Ahvaz Unrest Could End With Televised Confessions""Bombings Rock Iran Ahead of Election""Five die in Iran ethnic clashes""Iran: Need for restraint as anniversary of unrest in Khuzestan approaches"Archived"Iranian Sunni protesters killed in clashes with security forces"Archived

                    Can't initialize raids on a new ASUS Prime B360M-A motherboard2019 Community Moderator ElectionSimilar to RAID config yet more like mirroring solution?Can't get motherboard serial numberWhy does the BIOS entry point start with a WBINVD instruction?UEFI performance Asus Maximus V Extreme