Reboot a host using hammer cli

Once I provision a discovered host, the host goes to the all host list. After that I try to reboot the host using hammer cli (command: hammer host reboot --id [host_id], but everytime I get an error saying:
“Power operations are not enabled on this host”.

Expected result: Host should be rebooted successfully.

Any insights on what could cause this issue. Thank you for your time!

Hey @Bish123
What version of Foreman and associated plugins are you on?
You mention the hammer CLI. Is this the only method and you’ve it working via web UI/API?
Have you looked at your BMC Managing Hosts

Foreman version: 3.2
I can reboot it and perform all the actions with web UI. But, I want to make things work with hammer cli as well due to work reasons. I did look at bmc documentation that you referred to and followed but still getting same error:
I have created a bmc interface with correct domain and subnet, have provided mac address and updated the host but it does not seem to work.
Note: One thing I am confused about is if I am defining eth0 interface with mac address of the host, then while creating a bmc interface, I am not allowed to use the same mac address. could that be a problem?

Right now, if I want to reboot or just see status of bare-metal host with id 251 , I run this:

hammer host status --id 251

If I am right, this should tell me the status of my host, but it gives: “Power operations not enabled on this host”

Thank you so much for your time!

Hi, @Bish123, I hope your issue is solved now since it’s been a while, but in case it’s not:

I think you might have misconfigured either host or smart proxy which talks to the host you want to perform BMC operations on. To be honest, I’ve created simply a dummy host just to test and it worked on my side.

Could you please check your /etc/foreman-proxy/settings.d/bmc.yml configuration file if it’s configured properly. And check if the settings match the ones you provide to your BMC interface of the host.

1 Like