-
Notifications
You must be signed in to change notification settings - Fork 23.8k
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
Reboot action missing shutdown command from path on CentOS 7 (Ansible 2.7) #47131
Comments
I've also tried setting the path via the environment option for the reboot action: - name: reboot host
reboot:
environment:
PATH: "/usr/sbin/" This didn't seem to make a difference. Also verified my connection/command is run as root by adding this to my playbook: tasks:
- command: id
register: id
- debug:
var: id.stdout_lines stdout_lines output:
I did modify the Any pointers/suggestions would be welcome. |
cc @samdoran |
Something I forgot to add was the
So it appears the problem exists only via SSH, command locally works as expected. |
This is failing because the You list the target OS as "CentOS 6 CentOS Linux release 7.5.1804 (Core)". Is the target OS CentOS 6 or 7? It's curious that We have a needs_info |
Hi @shoekstra, thank you for submitting this issue! |
Hi @samdoran, Sorry for the confusion, it is indeed CentOS 7. It turns out I didn't have Thanks for the help and prompt reply! Stephen |
I also do not have secure path set. I do not wish to change my sudoers file just to be able to reboot using ansible.. this is really silly.. |
@Alb0t Agreed. I'll reopen this and work on a fix. |
I see the same issue ansible 2.7.2, RHEL 7.5 |
Also confirmed on Ansible 2.7.2/RHEL 7.6. Agree with @Alb0t that we shouldn't have to introduce sudoers behavioral changes for module success. |
@shoekstra @BradFelmey Can you please test with #49272 to see if that fixes the issue? I added code to search common paths on the managed node to find the absolute path the binary. |
@samdoran sorry for the delay! Just tested and it works for me. Removed
Tested reboot successfully:
Thanks for resolving this one! |
SUMMARY
Cannot reboot CentOS 6 hosts using the
reboot
action, get an error back thatshutdown
is not found in the path.When SSHing with the same command ansible uses for reboot:
When logged in (same result using sudo):
ISSUE TYPE
COMPONENT NAME
reboot
moduleANSIBLE VERSION
CONFIGURATION
OS / ENVIRONMENT
Target OS is CentOS 7
CentOS Linux release 7.5.1804 (Core)
STEPS TO REPRODUCE
roles/reboot/tasks/reboot_linux.yml:
playbooks/reboot_if_pending.yml
EXPECTED RESULTS
shutdown
command is found in path and host is restarted.ACTUAL RESULTS
reboot
action fails because it cannot find shutdown in the pathThe text was updated successfully, but these errors were encountered: