How to remove a host from foreman and unable to do with foreman-rake console also unable to remove from foreman console all hosts option.. Is there any better way to remove a host from foreman

**Problem: **

Expected outcome:

Foreman and Proxy versions:

Foreman and Proxy plugin versions:

Distribution and version:

Other relevant data:

Hi @Mahalakshmi

We would need some more info.

What happens when you try to remove the host? Is there an error? What is the error?

also

Foreman and Proxy versions:

Foreman and Proxy plugin versions:

Distribution and version:

When tried to delete a host from foreman , it says “unable to delete”.

When tried with below it gives output as “nil”

foreman-rake console
Host.find_by_name(“Host.example.com”).destroy.

Below is the version : 3.1.3-1.el7

Why are you trying to remove the host in this way?

foreman-rake console is not the correct way to remove hosts and should only be done when cleaning up from some other bug condition.

To remove a host, normally you’d use the web UI or Hammer. Have you tried that?

No I have not tried in that way, can u suggest how to do that

Yes i did by webui hosts> allhosts but getting an error “unable to delete”

Can you provide more info?

  1. A copy of the error in log/production.log around the time of failure (and several lines after it, so we can see the complete stack trace)
  2. A screenshot or exact wording of the error

When trying delete from Hosts > All Hosts > Delete i am getting below error.

Kindly suggest is there something i am missing

That [] is odd; it should be giving more information about why it can’t delete the host.

Can you please paste the section of production.log that contains that same error text, like I mentioned above?

Hi, I have succesfully delete hosts from foreman console. But deleted host is coming back to the All hosts sometime after deleting succesfully.

Below are the changes i did in “Admister settings” before deleting a host.

  1. Admister Settings >> Provisioning >> Destroy associated VM on host delete>> Changed to ‘Yes’

  2. Admister Settings >> PuppetDB >> puppetdb_enabled >> Changed to ‘No’

After the above changes i disassociated host and deleted succesfully. Can you please help on this why a deleted host is coming back.

Not all the hosts are coming backk, only few of the hosts are coming back

Can someone help me out on the above issue. The host which is coming back to foreman is getting deleted successfully without throwing any errors, but after sometime it is coming back to foreman.

Revoke the certificate. if its auto-sign it will come back.

Yes, Thank you. Will do that and update here

Hi, i did revoke the certificate. Even after that host comes back after deleting succesfully.

Can someone help on this why a deleted host is coming back even after revoking certificate

I think the auto-sign is true, so you can remove the server=yourpuppetserver to server= in you puppet.conf on the client