I am getting this error while installing git on hosts machine using ansible Please help

0 votes
"msg": "Repo rhui-rhel-7-server-rhui-extras-rpms forced skip_if_unavailable=True due to: /etc/pki/rhui/ca.crt\nRepo rhui-rhel-7-server-rhui-extras-rpms forced skip_if_unavailable=True due to: /etc/pki/rhui/product/content.crt\nRepo rhui-rhel-7-server-rhui-extras-rpms forced skip_if_unavailable=True due to: /etc/pki/rhui/key.pem\nRepo rhui-rhel-7-server-rhui-optional-rpms forced skip_if_unavailable=True due to: /etc/pki/rhui/ca.crt\nRepo rhui-rhel-7-server-rhui-optional-rpms forced skip_if_unavailable=True due to: /etc/pki/rhui/product/content.crt\nRepo rhui-rhel-7-server-rhui-optional-rpms forced skip_if_unavailable=True due to: /etc/pki/rhui/key.pem\nRepo rhui-rhel-7-server-rhui-rh-common-rpms forced skip_if_unavailable=True due to: /etc/pki/rhui/ca.crt\nRepo rhui-rhel-7-server-rhui-rh-common-rpms forced skip_if_unavailable=True due to: /etc/pki/rhui/product/content.crt\nRepo rhui-rhel-7-server-rhui-rh-common-rpms forced skip_if_unavailable=True due to: /etc/pki/rhui/key.pem\nRepo rhui-rhel-7-server-rhui-rpms forced skip_if_unavailable=True due to: /etc/pki/rhui/ca.crt\nRepo rhui-rhel-7-server-rhui-rpms forced skip_if_unavailable=True due to: /etc/pki/rhui/product/content.crt\nRepo rhui-rhel-7-server-rhui-rpms forced skip_if_unavailable=True due to: /etc/pki/rhui/key.pem\nRepo rhui-rhel-7-server-rhui-supplementary-rpms forced skip_if_unavailable=True due to: /etc/pki/rhui/ca.crt\nRepo rhui-rhel-7-server-rhui-supplementary-rpms forced skip_if_unavailable=True due to: /etc/pki/rhui/product/content.crt\nRepo rhui-rhel-7-server-rhui-supplementary-rpms forced skip_if_unavailable=True due to: /etc/pki/rhui/key.pem\nRepo rhui-rhel-server-rhui-rhscl-7-rpms forced skip_if_unavailable=True due to: /etc/pki/rhui/ca.crt\nRepo rhui-rhel-server-rhui-rhscl-7-rpms forced skip_if_unavailable=True due to: /etc/pki/rhui/product/content.crt\nRepo rhui-rhel-server-rhui-rhscl-7-rpms forced skip_if_unavailable=True due to: /etc/pki/rhui/key.pem\nYou need to be root to perform this command.\n",
    "rc": 1,
    "results": [
        ""
Aug 13, 2019 in DevOps & Agile by Sudhanshu
• 120 points

edited Aug 13, 2019 by Kalgi 2,297 views
Can you please add your ansible playbook? The error log clearly says that you need to be a root user to perform this action.

I was trying to install git on host machine using adhoc command.

ansible -m yum -a "name=git state=present" webservers

i have added user1 in sudoers list in /etc/sudoers but still getting same error.

Add -s to your ad hoc command. This will give it sudo privileges. so change t=your command to the followng:

ansible -s -m yum -a "name=git state=present" webservers

Check this and let me know if it works. 

I Tried this command but getting this error.

Usage: ansible <host-pattern> [options]

ansible: error: no such option: -s

Alright then, try adding the following line in your playbook 

become: true

It basically executes all commands with sudo privileges.

Did it work @Sudhanshu?
It worked in playbook ,but when trying to do as adhoc command it is failing with same error.
Try adding --sudo to that commandline.

For ansible versions older than 1.9, adding the flag, ask-sudo-pass should work.

For newer ansible versions(above 1.9), --ask-become-pass should work.

Try this and let me know.

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP