Dieser Inhalt ist in der von Ihnen ausgewählten Sprache nicht verfügbar.
Chapter 2. Managing Organizations, Locations, and Repositories
			You can use hammer to create, edit, and manage organizations, locations, and repositories. For web UI equivalents of the following procedures see Configuring Organizations, Locations and Life Cycle Environments in the Red Hat Satellite Server Administration Guide.
		
2.1. Organizations Link kopierenLink in die Zwischenablage kopiert!
				Organization in Red Hat Satellite is an isolated collection of systems, content, and other functionality within a Satellite deployment. This section shows how to create and modify organizations using hammer.
			
2.1.1. Creating an Organization Link kopierenLink in die Zwischenablage kopiert!
Use the following command to create an organization:
hammer organization create \ --name "<org_name>" \ --label "<org_label>" \ --description "<org_description>"
$ hammer organization create \
--name "<org_name>" \
--label "<org_label>" \
--description "<org_description>"
Where:
- <org_name> is the name of the organization. This parameter is required.
 - 
							<org_label> is the organization label used in command-line applications such as 
subscription-manager. Labels cannot contain white space and you cannot change them later. If not specified, label is generated automatically from the organization name (white space is replaced with underscores). - <org_description> is a short description of the organization. This parameter is not required, but it can help you to manage a large number of organizations.
 
					You can fully configure an organization while creating it (issue hammer organization create --help to see the options). Also, you can modify an existing organization using the hammer organization update command.
				
Example 2.1. Creating and Updating ACME Organization
The following example shows how to create an organization named ACME:
ORG="ACME" hammer organization create \ --name $ORG \ --description "Example organization"
$ ORG="ACME"
$ hammer organization create \
--name $ORG \
--description "Example organization"
This command assigns a compute resource to the organization:
hammer organization update \ --name $ORG \ --compute-resource-ids 1
$ hammer organization update \
--name $ORG \
--compute-resource-ids 1
						Many tasks you can perform in the Satellite Server are specific to an organization. Hammer commands provide three ways to identify an organization: by using the organization, organization-label, or organization-id option. To find the organization ID, use the following command:
					
hammer organization list
$ hammer organization list
If your organization name is long, consider storing it in a shell variable. You can use this variable in Hammer commands. For example:
ORG = "Red Hat Enterprise Linux Developer Team" hammer product list --organization $ORG
$ ORG = "Red Hat Enterprise Linux Developer Team"
$ hammer product list --organization $ORG
This approach is used in examples in this guide.
If you mostly manage a single organization, store its ID as a default parameter, for example:
hammer defaults add --param-name organization_id --param-value 1
$ hammer defaults add --param-name organization_id --param-value 1
						With the above setting, organization specific commands will assume --organization-id 1 is specified, so you no longer have to type it.
					
2.1.2. Uploading a Manifest Link kopierenLink in die Zwischenablage kopiert!
A Subscription Manifest transfers subscriptions from the Red Hat Customer Portal to Satellite Server. First, generate the manifest on the Red Hat Customer portal as described in the Red Hat Satellite Content Management Guide. Then upload the manifest to the organization as follows:
hammer subscription upload \ --organization-label <org_label> \ --file <path_to_manifest>
$ hammer subscription upload \
--organization-label <org_label> \
--file <path_to_manifest>
Example 2.2. Uploading a Manifest to ACME Organization
The following example shows how to upload a Subscription Manifest file to the ACME organization (assuming the organization name is stored in a shell variable):
hammer subscription upload --organization $ORG --file /tmp/manifest.zip
$ hammer subscription upload --organization $ORG --file /tmp/manifest.zip
To view the subscriptions imported with the manifest, issue:
hammer subscription list --organization $ORG
$ hammer subscription list --organization $ORG
2.2. Locations Link kopierenLink in die Zwischenablage kopiert!
				Location in Red Hat Satellite is collection of default settings that represent a physical place. This section shows how to create locations using hammer.
			
2.2.1. Creating a Location Link kopierenLink in die Zwischenablage kopiert!
Use the following command to create a location:
hammer location create --name <location_name>
$ hammer location create --name <location_name>
Example 2.3. Creating Multiple Locations Using a Script
The following Bash script creates three locations (london, munich, boston), and assigns them to the ACME organization.
					Run hammer location --help to view all possible location related operations.
				
2.3. Repositories Link kopierenLink in die Zwischenablage kopiert!
				Repository provides storage for a collection of content. This section shows how to enable and synchronize repositories using hammer.
			
2.3.1. Enabling a Repository Link kopierenLink in die Zwischenablage kopiert!
Before enabling a Red Hat repository, you need to know its name, the name of the product it provides, the base architecture, and the release version. Use the following command to enable a repository:
Example 2.4. Enabling a Red Hat Enterprise Linux Repository
The following command enables the Red Hat Enterprise Linux 7 Server repository for the organization:
					Run hammer repository-set --help to view all possible repository related operations. Also see hammer repository --help.
				
2.3.2. Synchronizing a Repository Link kopierenLink in die Zwischenablage kopiert!
By synchronizing a repository you pull its content from Red Hat Customer Portal to the Satellite Server. To synchronize a repository you need to specify its name and a product name:
hammer repository synchronize \ --product "<product_name>" \ --name "<repo_name>" \ --organization-label <org_label> \ --async
$ hammer repository synchronize \
--product "<product_name>" \
--name "<repo_name>" \
--organization-label <org_label> \
--async
					Note that if you have created Content Views, multiple repositories with the same name can exist within a single organization. In such a case, use the --id option to identify the repository you want to synchronize (issue hammer repository list to find repository IDs).
				
Example 2.5. Synchronizing a Red Hat Enterprise Linux Repository
The following command performs a single synchronization of the Red Hat Enterprise Linux 7 Server repository in the organization:
hammer repository synchronize \ --product "Red Hat Enterprise Linux Server" \ --name "Red Hat Enterprise Linux 7 Server (RPMs)" \ --organization $ORG \ --async
$ hammer repository synchronize \
--product "Red Hat Enterprise Linux Server" \
--name "Red Hat Enterprise Linux 7 Server (RPMs)" \
--organization $ORG \
--async
The task ID is displayed after executing the above command:
Repository is being synchronized in task 640bb71f-0ce5-40a3-a675-425a4acacceb
Repository is being synchronized in task 640bb71f-0ce5-40a3-a675-425a4acacceb
To view the progress of the task, issue:
hammer task progress --id 640bb71f-0ce5-40a3-a675-425a4acacceb
$ hammer task progress --id 640bb71f-0ce5-40a3-a675-425a4acacceb
After finishing the first synchronization, the repository is added to the list of repositories mirrored on Satellite Server. Execute the following command to see the list:
hammer repository list --organization $ORG
$ hammer repository list --organization $ORG
You can also synchronize all repositories within a product as follows:
hammer product synchronize \ --organization-label <org_label> \ --name "<product_name>" \ --async
$ hammer product synchronize \
--organization-label <org_label> \
--name "<product_name>" \
--async
					With the --async option, the repository synchronization runs in the background, which for example allows you to enable and synchronize several repositories in parallel.
				
Example 2.6. Synchronizing All Repositories in ACME Organization
The following Bash script synchronizes all repositories within the ACME organization.
2.3.3. Creating a Synchronization Plan Link kopierenLink in die Zwischenablage kopiert!
Product in Red Hat Satellite is a collection of repositories that acts as the smallest unit of the synchronization process. You can create a synchronization plan to automatically update repositories of a selected product in a given time interval.
To define a synchronization plan, issue the following command:
					Replace <repetition_interval> with hourly, daily, or weekly. Replace <initial_sync> with the date and time of the initial synchronization in the form of "YYYY-MM-DD HH:MM:SS".
				
Example 2.7. Creating a Synchronization Plan
The following command creates a daily synchronization schedule for the ACME organization, that runs at 3 a.m., starting from 15 January 2016:
To associate the synchronization plan with a product, issue the following command:
hammer product set-sync-plan \ --organization-label <org_label> \ --name "<product_name>" \ --sync-plan "<sync_plan_name>"
$ hammer product set-sync-plan \
--organization-label <org_label> \
--name "<product_name>" \
--sync-plan "<sync_plan_name>"
Example 2.8. Assigning a Synchronization Plan to Multiple Products
The following Bash script selects the products in the ACME organization that have been synchronized at least once and contain at least one repository and assigns them a synchronization plan named "daily sync at 3 a.m.".
After executing the script, issue the following command to see which products have been assigned the synchronization plan:
hammer product list --organization $ORG --sync-plan "daily sync at 3 a.m."
$ hammer product list --organization $ORG --sync-plan "daily sync at 3 a.m."
To view synchronization plans available for a selected organization, issue the following command:
hammer sync-plan list --organization-label <org_label>
$ hammer sync-plan list --organization-label <org_label>
					For more details on working with products and synchronization plans see the output of hammer sync-plan --help and hammer product --help.
				
2.3.4. Creating a Custom Repository Link kopierenLink in die Zwischenablage kopiert!
After enabling a Red Hat repository, the corresponding product is created automatically. To enable a repository with custom packages, you first need to manually create a product for this repository.
Use the following command to create a custom product:
hammer product create --name "<product_name>" --organization-label <org_label>
$ hammer product create --name "<product_name>" --organization-label <org_label>
The following command creates a new repository under the custom product:
Replace the example values with your own details, in particular:
- 
							<cont_type> specifies the type of content in the repository, choose one of 
yum,puppet, ordocker. - <repo_url> specifies the URL on which the repository will be available, valid only if ` --publish-via-http` is enabled.
 
To upload packages to a custom repository, issue the following command:
hammer repository upload-content \ --product "<product_name>" \ --organization-label <org_label> \ --id "<repo_id>" \ --path <path_to_dir>
$ hammer repository upload-content \
--product "<product_name>" \
 --organization-label <org_label> \
 --id "<repo_id>" \
--path <path_to_dir>
Replace <path_to_dir> with the path to the directory with content (RPM packages, Puppet modules, or Docker images) to be added to the custom repository.