Chapter 7. Managing locations Locations function similar to organizations: they provide a method to group resources and assign hosts. Organizations and locations have the following conceptual differences: Locations are based on physical or geographical settings. Locations have a hierarchical structure. 7.1. Creating a location Use this procedure to create a location so that you can manage your hosts and resources by location. To use the CLI instead of the Satellite web UI, see the CLI procedure . Procedure In the Satellite web UI, navigate to Administer > Locations . Click New Location . Optional: From the Parent list, select a parent location. This creates a location hierarchy. In the Name field, enter a name for the location. Optional: In the Description field, enter a description for the location. Click Submit . If you have hosts with no location assigned, add any hosts that you want to assign to the new location, then click Proceed to Edit . Assign any infrastructure resources that you want to add to the location. This includes networking resources, installation media, Kickstart templates, and other parameters. You can return to this page at any time by navigating to Administer > Locations and then selecting a location to edit. Click Submit to save your changes. CLI procedure Enter the following command to create a location: 7.2. Creating multiple locations The following example Bash script creates three locations - London, Munich, Boston - and assigns them to the Example Organization. ORG=" Example Organization " LOCATIONS=" London Munich Boston " for LOC in USD{LOCATIONS} do hammer location create --name "USD{LOC}" hammer location add-organization --name "USD{LOC}" --organization "USD{ORG}" done 7.3. Setting the location context A location context defines the location to use for a host and its associated resources. Procedure The location menu is the second menu item in the menu bar, on the upper left of the Satellite web UI. If you have not selected a current location, the menu displays Any Location . Click Any location and select the location to use. CLI procedure While using the CLI, include either --location " My_Location " or --location-id " My_Location_ID " as an option. For example: This command lists hosts associated with the My_Location location. 7.4. Deleting a location You can delete a location if the location is not associated with any lifecycle environments or host groups. If there are any lifecycle environments or host groups associated with the location you are about to delete, remove them by navigating to Administer > Locations and clicking the relevant location. Do not delete the default location created during installation because the default location is a placeholder for any unassociated hosts in the Satellite environment. There must be at least one location in the environment at any given time. Procedure In the Satellite web UI, navigate to Administer > Locations . Select Delete from the list to the right of the name of the location you want to delete. Click OK to delete the location. CLI procedure Enter the following command to retrieve the ID of the location that you want to delete: From the output, note the ID of the location that you want to delete. Enter the following command to delete the location:

Commands:
hammer location create --description " My_Location_Description " --name " My_Location " --parent-id " My_Location_Parent_ID "
ORG=" Example Organization " LOCATIONS=" London Munich Boston " for LOC in USD{LOCATIONS} do hammer location create --name "USD{LOC}" hammer location add-organization --name "USD{LOC}" --organization "USD{ORG}" done
hammer host list --location " My_Location "
hammer location list
hammer location delete --id Location ID