How to restore 'Satellite' entry deleted accidentally from 'All Hosts' page in Satellite WebUI?

Solution Verified - Updated

Environment

  • Red Hat Satellite 6.x

Issue

  • How to restore the Host profile of Satellite server itself, if deleted accidentally from the All Hosts page in Satellite WebUI or via hammer_cli ?

Resolution

  • Ensure that the following settings are set to true for the concerned satellite server.

    # hammer --csv settings list --fields "Name,Full name,Value" | egrep "append_domain_name_for_hosts|create_new_host|^Name" | column -s, -t
    Name                                     Full name                                Value
    append_domain_name_for_hosts             Append domain names to the host          true
    create_new_host_when_facts_are_uploaded  Create new host when facts are uploaded  true
    create_new_host_when_report_is_uploaded  Create new host when report is uploaded  true
    
  • For Red Hat Satellite 6.10 and below, To get the host profile back in the WebUI, please execute the following command:

    # puppet agent -tv
    
  • For any newly installed Red Hat Satellite 6.11 or later versions, please execute the following command:

    # satellite-installer --verbose
    
    • After the command completes, The puppet facts from the OS will be uploaded to the foreman database and will create the profile of the satellite server back in the Hosts-> All hosts page.

    • This new profile might not have any organization or location assigned, Hence switch to Any Organization and Any Location context and then visit the Hosts-> All hosts page.

    • In case the satellite-installer fails on the same error Host satellite.example.com does not exist in Foreman at https://satellite.example.com/, check if there isn't a Host under short name, like:

    hammer host list --search name=satellite
    
    • if there is one, delete it (hammer host delete --name=satellite) and run installer again.
    • if you can't find such one or you see more than one, check what Host foreman associated the uploaded facts for - search in /var/log/foreman/production.log for POST request like:
2023-01-01T12:34:56 [I|app|01234567] Started POST "/api/v2/hosts/facts" for 1.2.3.4 at 2023-01-01 12:34:56 +0000
2023-01-01T12:34:56 [I|app|01234567] Processing by Api::V2::HostsController#facts as JSON
2023-01-01T12:34:56 [I|app|01234567]   Parameters: {"name"=>"satellite.example.com", "certname"=>"satellite.example.com", "facts"=>"[FILTERED]", "apiv"=>"v2", "host"=>{"certname"=>"satellite.example.com", "name"=>"satellite.example.com"}}
2023-01-01T12:34:56 [I|app|01234567] Import facts for 'OFFENDING-HOST-NAME' completed. Added: 0, Updated: 0, Deleted 0 facts

.. and spot the OFFENDING-HOST-NAME

SBR
Product(s)
Components
Category

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.