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

Role execution fails if not running under root user #58

Open
KKoukiou opened this issue Aug 1, 2017 · 4 comments
Open

Role execution fails if not running under root user #58

KKoukiou opened this issue Aug 1, 2017 · 4 comments

Comments

@KKoukiou
Copy link
Contributor

KKoukiou commented Aug 1, 2017

TASK [provision_docker : Install libselinux-python package for 'copy' task] ******************************************************************************************************************
fatal: [localhost]: FAILED! => {"changed": false, "failed": true, "msg": "This command has to be run under the root user."}

I have the libselinux package already installed on my machine, but even for checking if the package is installed it requires root, which is not expected behavior.

I tried to replace the package module with yum module which works on my system and it succeeds as expected, so I guess we can replace it here as well.

Affects only system where ansible_os_family== "Redhat"

@KKoukiou KKoukiou changed the title Role execution fails if not running user root user Role execution fails if not running under root user Aug 1, 2017
@KKoukiou
Copy link
Contributor Author

KKoukiou commented Aug 1, 2017

@orpiske this PR introduced the issue #54
I will open also issue in ansible for the package module.

@lukas-bednar
Copy link
Contributor

lukas-bednar commented Aug 7, 2017

The error actually comes from dnf_module, so it might be better to open issue there .
ansible/ansible#27844

lukas-bednar added a commit to rhevm-qe-automation/provision_docker that referenced this issue Oct 23, 2017
Since the issue chrismeyersfsu#58 prevents me to run playbook under non-root user.
@thatnerdjosh
Copy link

@lukas-bednar I am getting this issue as well, is there a way to tell it to run as sudo?

Trying to use this role https://github.com/geerlingguy/ansible-role-docker and I get this when running ansible-playbook -K setup_docker.yml:

failed: [localhost] (item=docker) => {"changed": false, "cmd": "dnf install -y python2-dnf", "item": "docker", "msg": "Error: This command has to be run under the root user.", "rc": 1, "stderr": "Error: This command has to be run under the root user.\n", "stderr_lines": ["Error: This command has to be run under the root user."], "stdout": "", "stdout_lines": []}
failed: [localhost] (item=docker-common) => {"changed": false, "cmd": "dnf install -y python2-dnf", "item": "docker-common", "msg": "Error: This command has to be run under the root user.", "rc": 1, "stderr": "Error: This command has to be run under the root user.\n", "stderr_lines": ["Error: This command has to be run under the root user."], "stdout": "", "stdout_lines": []}
failed: [localhost] (item=docker-engine) => {"changed": false, "cmd": "dnf install -y python2-dnf", "item": "docker-engine", "msg": "Error: This command has to be run under the root user.", "rc": 1, "stderr": "Error: This command has to be run under the root user.\n", "stderr_lines": ["Error: This command has to be run under the root user."], "stdout": "", "stdout_lines": []}

@lukas-bednar
Copy link
Contributor

@NerdsvilleCEO Hi, you can make whole playbook run as a sudo, but I am afraid that you can not do that for particular task which causes failure - I am using patched version of this repository where I use yum module instead of package, you can do same if you like, but it is not really nice ... better to get fix ;-) for dnf module ...

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