3.2. 自定义注册模板

如果要自定义注册过程,请使用本节中的信息。

请注意,卫星中的所有默认模板都锁定。如果要自定义注册过程,您需要克隆默认模板并编辑克隆。然后,在 Administer > Settings > Provisioning 中更改 Default Global registration 模板和 Default 'Host initial configuration' 模板 设置,以指向您的自定义模板。

模板

注册过程使用以下注册模板:

  • Global Registration 模板包含将主机注册到 Satellite 的步骤。当主机访问 /register 端点时,此模板呈现。
  • Linux host_init_config 默认模板 包含主机注册后初始配置的步骤。

全局参数

您可以通过导航到 Configure > Global Parameters 来配置以下全局参数:

  • host_registration_remote_execution 参数在 remote_execution_ssh_keys 代码段中使用,默认值为 true
  • host_registration_insights 参数用于 insights 片断,默认值为 true。将参数类型设置为 boolean 以覆盖参数值。如果 参数设置为 false,它会防止 Satellite 和 Insights 客户端将清单报告上传到 Red Hat Hybrid Cloud Console。
  • host_packages 参数用于在主机上安装软件包。
  • remote_execution_ssh_keys, remote_execution_ssh_user, remote_execution_create_userremote_execution_effective_user_method 参数在 remote_execution_ssh_keys 中使用。如需更多详细信息,请说明代码片段的详细信息。
  • encrypt_grub 参数是为主机启用加密引导装载程序密码的设置,默认值为 false

    要实际设置密码,请使用您模板中的 grub_pass 宏。

片断

片断在 Linux host_init_config 默认模板 中使用:

  • remote_execution_ssh_keys 片断仅在 host_registration_remote_execution 参数为 true 时将 SSH 密钥部署到主机。
  • 当全局参数 host_registration_insights 被设置为 true 时,insights 片断下载并安装 Red Hat Insights 客户端。
  • puppetlabs_repopuppet_setup 片断会在主机上下载并安装 Puppet 代理(仅在分配了 Puppet 服务器时)安装 Puppet 代理。
  • host_init_config_post 是主机初始配置期间用户自定义操作为空的代码片段。

变量

下表描述了 Global Registration 模板中使用的变量。

表 3.1. 全局注册模板变量

变量命令参数描述

@user

none

当前经过身份验证的用户对象。

@organization

organization_id

如果没有设置 organization_id,则会设置用户的默认机构,或者从用户机构列表中的第一个机构。

@location

location_id

如果没有设置 location_id,则会设置用户的默认位置,或者用户位置列表中的第一个位置。

@hostgroup

hostgroup_id

主机组。

@operatingsystem

operatingsystem_id

主机操作系统.

@setup_insights

setup_insights

覆盖注册主机的 host_registration_insights global 参数的值,并安装 insights 客户端。

@setup_remote_execution

setup_remote_execution

覆盖用于注册主机的 host_registration_remote_execution 全局参数的值,并部署用于远程执行的 SSH 密钥。

@setup_remote_execution

setup_remote_execution

为远程执行设置主机的默认接口。

@packages

软件包

要安装的软件包

@repo

repo

在主机上添加存储库

@repo_gpg_key_url

repo_gpg_key_url

设置存储库 GPG 密钥表单 URL

@activation_keys

activation_keys

主机激活码.

@force

force

删除任何 katello-ca-consumer* rpms,并使用 --force 参数运行 subscription-manager register 命令。

@ignore_subman_errors

ignore_subman_errors

忽略 subscription-manager 错误

@lifecycle_environment_id

lifecycle_environment_id

生命周期环境 ID

@registration_url

none

/register 端点的 URL。