Role execution fails if not running under root user
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"
@orpiske this PR introduced the issue https://github.com/chrismeyersfsu/provision_docker/pull/54 I will open also issue in ansible for the package module.
The error actually comes from dnf_module, so it might be better to open issue there . https://github.com/ansible/ansible/issues/27844
@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": []}
@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 ...