3.2. 自定义注册模板

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

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

模板

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

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

全局参数

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

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

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

片断

Linux host_init_config 默认 模板中使用代码片段:

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

变量

下表描述了 全局注册 模板中使用什么变量。

表 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 全局参数的值,并安装 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。