此内容没有您所选择的语言版本。

Chapter 5. Configuring Provisioning Environment


This section shows how to configure various stages of your provisioning environment using hammer. For web UI equivalents of the following procedures see Configuring Provisioning Resources in the Provisioning Guide.

5.1. Domains

Domains in Red Hat Satellite represent DNS zones. Satellite has the ability to assign domain names with Red Hat Satellite Capsule Server DNS. This provides users with a means to group and name hosts within a particular domain and associate them with parameters and Puppet variables.

To create a new domain, issue the following command:

$ hammer domain create --name domain_name
Copy to Clipboard

You can associate the newly created domain to organizations and locations using the hammer organization add-domain or hammer location add-domain commands. To view the status of a domain, issue the following command:

$ hammer domain info --name domain_name
Copy to Clipboard

5.2. Subnets

Subnets in Red Hat Satellite define networks specified for groups of systems. Subnets use standard IP-address settings to define the network and use the Red Hat Satellite Capsule Server’s DHCP features to assign IP addresses to systems within the subnet. The following command contains the minimal set of options required for subnet creation:

$ hammer subnet create \
--name subnet_name \
--organization-ids org_ID1,org_ID2... \
--location-ids loc_ID1,loc_ID2... \
--domain-ids dom_ID1,dom_ID2... \
--boot-mode boot_mode \
--network network_address \
--mask netmask \
--ipam ipam
Copy to Clipboard

Here, boot_mode is one of Static or DHCP, ipam is one of DHCP, Internal DB, or None. If using DHCP, you can set the IP range with the --from and --to options. For the full list of configurable options, see the output of the hammer subnet create --help command.

5.3. Architectures

Architecture in Satellite represents a logical grouping of hosts and operating systems. To view the architectures, issue the following command:

$ hammer architecture list
Copy to Clipboard

Architectures are created by Satellite automatically when hosts are registered in Puppet, therefore it is rarely needed to create them manually (even though hammer provides this option).

5.4. Compute Resources

Compute resources are hardware abstractions from virtualization and cloud providers. Satellite uses compute resources to provision virtual machines and containers. Run the following command to create a compute resource:

$ hammer compute-resource create \
--name cr_name \
--organization-ids org_ID1,org_ID2... \
--location-ids loc_ID1,loc_ID2... \
--provider provider
Copy to Clipboard

Here, provider is one of: RHEV, RHEL OpenStack Platform, Libvirt, Docker, Rackspace, Google, EC2, or VMware. Depending on the provider type, other options such as --url, or --user may be required. See the output of the hammer compute-resource create --help command for details.

5.5. Installation Media

Installation media (ISO images) provide content for kickstart trees and new host installations in Red Hat Satellite. To list the media, issue the following command:

$ hammer medium list
Copy to Clipboard

To add a new medium, issue the following command:

$ hammer medium create --name medium_name --path path_to_medium
Copy to Clipboard

You can make the medium available to organizations and locations directly when adding it (see the output of the hammer medium create --help command), or later by using the hammer organization add-medium or hammer location add-medium commands.

5.6. Partition Tables

Partition tables define the partitions and file system layout for new installations when provisioning systems. Red Hat Satellite provides default partition tables associated with operating system families, to view them, issue the following command:

$ hammer partition-table list
Copy to Clipboard

To create a new partition table, issue the following command:

$ hammer partition-table create \
--name table_name \
--file path_to_layout_file \
--os-family os_family
Copy to Clipboard

See the output of the hammer partition-table --help command for other subcommands.

5.7. Provisioning Templates

Provisioning templates provide the systematic means to run unattended installations. To view the provisioning templates provided by Satellite, enter the following command:

$ hammer template list
Copy to Clipboard

To add a new template, enter the following command:

$ hammer template create --name template_name --file path_to_template_file
Copy to Clipboard

See the output of the hammer template --help command for other subcommands.

5.7.1. Importing Templates

You can use the hammer import-templates command to import templates from a repository of your choice. You can use different protocols to point to your repository, for example /tmp/dir, git://example.com, https://example.com, and ssh://example.com.

For better indexing and management of your templates, use --prefix to set a category for your templates. To select certain templates from a large repository, use --filter to define the title of the templates that you want to import. For example --filter '.*Ansible Default$' imports various Ansible Default templates.

To import a template from a repository, enter the following command:

$ hammer import-templates \
    --prefix '[Custom Index] ' \
    --filter '.*Template Name$' \
    --repo https://github.com/examplerepo/exampledirectory \
    --branch my_branch \
    --organization 'Default Organization'
Copy to Clipboard

5.7.2. Exporting templates

You can use the hammer export-templates command to export templates to a Git repository.

  1. Clone a local copy of your Git repository:

    $ git clone https://github.com/theforeman/community-templates /custom/templates
    Copy to Clipboard
  2. Change the owner of your local directory to the foreman user, and change the SELinux context with the following commands:

    # chown -R foreman:foreman /custom/templates
    # chcon -R -t httpd_sys_rw_content_t /custom/templates
    Copy to Clipboard
  3. To export the templates to your local repository, enter the following command:

    hammer export-templates --organization 'Default Organization' --repo /custom/templates
    Copy to Clipboard

5.8. Operating Systems

Operating systems define combinations of installation methods and media and are grouped within families. As a default, Red Hat Satellite uses a Red Hat family. Families allow Satellite to change certain behaviors when provisioning hosts. To list operating systems, issue the following command:

$ hammer os list
Copy to Clipboard

To create a new operating system, issue the following command:

$ hammer os create --name os_name --major version_number
Copy to Clipboard

Then you can add architectures, partition tables, installation media, and configuration templates to the operating system. See the output of the hammer os --help command for details.

Example 5.1. Updating Multiple Operating Systems

The following Bash script assigns each operating system a partition table (Kickstart default), configuration template (Kickstart default PXELinux), and provisioning template (Satellite Kickstart Default).

PARTID=$(hammer --csv partition-table list | grep "Kickstart default" | cut -d, -f1)
PXEID=$(hammer --csv template list --per-page=1000 | grep "Kickstart default PXELinux" | cut -d, -f1)
SATID=$(hammer --csv template list --per-page=1000 | grep "provision" | grep "Satellite Kickstart Default" | cut -d, -f1)

for i in $(hammer --csv os list | grep -vi '^ID' | awk -F, {'print $1'})
do
   hammer partition-table add-operatingsystem --id="${PARTID}" --operatingsystem-id="${i}"
   hammer template add-operatingsystem --id="${PXEID}" --operatingsystem-id="${i}"
   hammer os set-default-template --id="${i}" --config-template-id="${PXEID}"
   hammer os add-config-template --id="${i}" --config-template-id="${SATID}"
   hammer os set-default-template --id="${i}" --config-template-id="${SATID}"
done
Copy to Clipboard

You can add grep commands to the for statement to further specify the affected operating systems. To verify if the assignment was performed correctly, use the hammer os info command.

5.9. Parameters

Parameters define the behavior of Red Hat Satellite during provisioning. There are several types of parameters, see Parameters in the Puppet Guide for details. Use the following example to set a global parameter:

$ hammer global-parameter set --name param_name --value param_value
Copy to Clipboard

Example 5.2. Setting a Global Parameter to Disable the Firewall

Run the following command to set the firewall global option to disabled:

$ hammer global-parameter set --name firewall --value --disabled
Copy to Clipboard

To verify the setting, issue the following command:

$ hammer global-parameter list
---------|-------------
NAME     | VALUE
---------|-------------
firewall | --disabled
---------|-------------
Copy to Clipboard

Similarly, you can use hammer to set other parameter types:

  • To set domain parameters, use:
$ hammer domain set-parameter \
--name param_name \
--value param_value \
--domain domain_name
Copy to Clipboard
  • To set host group parameters, use:
$ hammer hostgroup set-parameter \
--name param_name \
--value param_value \
--hostgroup hg_name
Copy to Clipboard
  • To set host parameters, use:
$ hammer host set-parameter \
--name param_name \
--value param_value \
--host h_name
Copy to Clipboard
  • To update smart class parameters, use:
$ hammer sc-param \
--name param_name \
--default-value param_value
Copy to Clipboard
返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2025 Red Hat