검색

이 콘텐츠는 선택한 언어로 제공되지 않습니다.

Chapter 3. Working with host groups

download PDF

A host group acts as a template for common host settings. Instead of defining the settings individually for each host, use host groups to define common settings once and apply them to multiple hosts.

3.1. Host group settings and nested host groups

A host group can define many settings for hosts, such as lifecycle environment, content view, or Ansible roles that are available to the hosts.

Important

When you change the settings of an existing host group, the new settings do not propagate to the hosts assigned to the host group. Only Puppet class settings get updated on hosts after you change them in the host group.

You can create a hierarchy of host groups. Aim to have one base level host group that represents all hosts in your organization and provides general settings, and then nested groups that provide specific settings.

Satellite applies host settings in the following order when nesting host groups:

  • Host settings take priority over host group settings.
  • Nested host group settings take priority over parent host group settings.

Example 3.1. Nested host group hierarchy

You create a top-level host group named Base and two nested host groups named Webserver and Storage. The nested host groups are associated with multiple hosts. You also create host custom.example.com that is not associated with any host group.

You define the operating system on the top-level host group (Base) and Ansible roles on the nested host groups (Webservers and Storage).

Top-level host groupNested host groupHostsSettings inherited from host groups

Base

This host group applies the Red Hat Enterprise Linux 8.8 operating system setting.

Webservers

This host group applies the linux-system-roles.selinux Ansible role.

webserver1.example.com

Hosts use the following settings:

  • Red Hat Enterprise Linux 8.8 defined by host group Base
  • linux-system-roles.selinux defined by host group Webservers

webserver2.example.com

Storage

This host group applies the linux-system-roles.postfix Ansible role.

storage1.example.com

Hosts use the following settings:

  • Red Hat Enterprise Linux 8.8 defined by host group Base
  • linux-system-roles.postfix defined by host group Storage

storage2.example.com

[No host group]

custom.example.com

No settings inherited from host groups.

Example 3.2. Nested host group settings

You create a top-level host group named Base and two nested host groups named Webserver and Storage. You also create host custom.example.com that is associated with the top-level host group Base, but no nested host group.

You define different values for the operating system and Ansible role settings on the top-level host group (Base) and nested host groups (Webserver and Storage).

Top-level host groupNested host groupHostSettings inherited from host groups

Base

This host group applies these settings:

  • The Red Hat Enterprise Linux 8.8 operating system
  • The linux-system-roles.selinux Ansible role

Webservers

This host group applies these settings:

  • The Red Hat Enterprise Linux 8.9 operating system
  • No Ansible role

webserver1.example.com

Hosts use the following settings:

  • The Red Hat Enterprise Linux 8.9 operating system from host group Webservers
  • The linux-system-roles.selinux Ansible role from host group Base

webserver2.example.com

Storage

This host group applies these settings:

  • No operating system
  • The linux-system-roles.postfix Ansible role

storage1.example.com

Hosts use the following settings:

  • The Red Hat Enterprise Linux 8.8 operating system from host group Base
  • The linux-system-roles.postfix Ansible role from host group Storage

storage2.example.com

[No nested host group]

custom.example.com

Host uses the following settings:

  • The Red Hat Enterprise Linux 8.8 operating system from host group Base
  • The linux-system-roles.selinux Ansible role from host group Base

3.2. Creating a host group

Create a host group to be able to apply host settings to multiple hosts.

To use the CLI instead of the Satellite web UI, see the CLI procedure.

Procedure

  1. In the Satellite web UI, navigate to Configure > Host Groups and click Create Host Group.
  2. If you have an existing host group that you want to inherit attributes from, you can select a host group from the Parent list. If you do not, leave this field blank.
  3. Enter a Name for the new host group.
  4. Enter any further information that you want future hosts to inherit.
  5. Click the Ansible Roles tab, and from the Ansible Roles list, select one or more roles that you want to add to the host. Use the arrow icon to manage the roles that you add or remove.
  6. Click the additional tabs and add any details that you want to attribute to the host group.

    Note

    Puppet fails to retrieve the Puppet CA certificate while registering a host with a host group associated with a Puppet environment created inside a Production environment.

    To create a suitable Puppet environment to be associated with a host group, manually create a directory:

    # mkdir /etc/puppetlabs/code/environments/example_environment
  7. Click Submit to save the host group.

CLI procedure

  • Create the host group with the hammer hostgroup create command. For example:

    # hammer hostgroup create --name "Base" \
    --architecture "My_Architecture" \
    --content-source-id _My_Content_Source_ID_ \
    --content-view "_My_Content_View_" \
    --domain "_My_Domain_" \
    --lifecycle-environment "_My_Lifecycle_Environment_" \
    --locations "_My_Location_" \
    --medium-id _My_Installation_Medium_ID_ \
    --operatingsystem "_My_Operating_System_" \
    --organizations "_My_Organization_" \
    --partition-table "_My_Partition_Table_" \
    --puppet-ca-proxy-id _My_Puppet_CA_Proxy_ID_ \
    --puppet-environment "_My_Puppet_Environment_" \
    --puppet-proxy-id _My_Puppet_Proxy_ID_ \
    --root-pass "My_Password" \
    --subnet "_My_Subnet_"

3.3. Creating a host group for each lifecycle environment

Use this procedure to create a host group for the Library lifecycle environment and add nested host groups for other lifecycle environments.

Procedure

To create a host group for each lifecycle environment, run the following Bash script:

MAJOR="My_Major_OS_Version"
ARCH="My_Architecture"
ORG="My_Organization"
LOCATIONS="My_Location"
PTABLE_NAME="My_Partition_Table"
DOMAIN="My_Domain"

hammer --output csv --no-headers lifecycle-environment list --organization "${ORG}" | cut -d ',' -f 2 | while read LC_ENV; do
  [[ ${LC_ENV} == "Library" ]] && continue

  hammer hostgroup create --name "rhel-${MAJOR}server-${ARCH}-${LC_ENV}" \
    --architecture "${ARCH}" \
    --partition-table "${PTABLE_NAME}" \
    --domain "${DOMAIN}" \
    --organizations "${ORG}" \
    --query-organization "${ORG}" \
    --locations "${LOCATIONS}" \
    --lifecycle-environment "${LC_ENV}"
done

3.4. Adding a host to a host group

You can add a host to a host group in the Satellite web UI.

Procedure

  1. In the Satellite web UI, navigate to Hosts > All Hosts.
  2. Click the name of the host you want to modify.
  3. Click Edit.
  4. Select the host group from the Host Group list.
  5. Click Submit.

Verification

  • The Details card under the Overview tab now shows the host group your host belongs to.

3.5. Changing the host group of a host

Use this procedure to change the Host Group of a host.

If you reprovision a host after changing the host group, the fresh values that the host inherits from the host group will be applied.

Procedure

  1. In the Satellite web UI, navigate to Hosts > All Hosts.
  2. Click the name of the host you want to modify.
  3. Click Edit.
  4. Select the new host group from the Host Group list.
  5. Click Submit.

Verification

  • The Details card under the Overview tab now shows the host group your host belongs to.
Red Hat logoGithubRedditYoutubeTwitter

자세한 정보

평가판, 구매 및 판매

커뮤니티

Red Hat 문서 정보

Red Hat을 사용하는 고객은 신뢰할 수 있는 콘텐츠가 포함된 제품과 서비스를 통해 혁신하고 목표를 달성할 수 있습니다.

보다 포괄적 수용을 위한 오픈 소스 용어 교체

Red Hat은 코드, 문서, 웹 속성에서 문제가 있는 언어를 교체하기 위해 최선을 다하고 있습니다. 자세한 내용은 다음을 참조하세요.Red Hat 블로그.

Red Hat 소개

Red Hat은 기업이 핵심 데이터 센터에서 네트워크 에지에 이르기까지 플랫폼과 환경 전반에서 더 쉽게 작업할 수 있도록 강화된 솔루션을 제공합니다.

© 2024 Red Hat, Inc.