I am trying to run an ansible-playbook from the cloud-user(non-root)
user on the RHEL machine. The playbook requires sudo access, for which I have used the below command -
ansible-playbook -i inventory -e @install_vars.yaml playbooks/install.yaml --become-method=sudo --become
On using the become
it has solved the issues encountered earlier of the package installations. However, I get the following error:
fatal: [ash-test-bb22-bastion-0]: FAILED! => {"changed": true, "cmd": "openshift-install create manifests --log-level info", "delta": "0:00:00.002662", "end": "2022-01-20 04:36:30.224594", "msg": "non-zero return code", "rc": 127, "start": "2022-01-20 04:36:30.221932", "stderr": "/bin/sh: openshift-install: command not found", "stderr_lines": ["/bin/sh: openshift-install: command not found"], "stdout": "", "stdout_lines": []}
openshift-install
executable is available under the /usr/local/bin
directory and works fine when the user is root.
PATH also has it defined. PATH=/home/cloud-user/.local/bin:/home/cloud-user/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin
Am I doing anything wrong? Can anybody tell me the exact command for the ansible-playbook for the above scenario?
As suggested by @Zeitounator, I modified the /etc/sudoers file and updated the $PATH variable which solved the above issue.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.