nycrecords.rhsm
Ansible 角色: RHSM
此角色将使用 subscription-manager 注册或注销系统,并可以启用或禁用通过订阅提供的库。
要求
Ansible 2.4 或更高版本
红帽企业 Linux 7 或同等版本
有效的红帽订阅
角色变量
当前支持以下变量:
订阅管理
本节中的变量直接对应于 redhat_subscription 模块 中的参数。
rhsm_username- access.redhat.com 或 Satellite (RHSM 提供者) 的用户名rhsm_password- access.redhat.com 或 Satellite (RHSM 提供者) 的密码rhsm_org_id- RHSM 提供者的组织 IDrhsm_activationkey- RHSM 提供者的激活密钥rhsm_server_hostname- 替代 RHSM 提供者的主机名rhsm_server_insecure- 连接到 RHSM 提供者时禁用证书验证(布尔值,默认为 false)rhsm_baseurl- 如果不使用红帽 CDN,则为软件包库的替代基本 URLrhsm_server_proxy_hostname- HTTP 代理的主机名rhsm_server_proxy_port- HTTP 代理的端口rhsm_server_proxy_user- HTTP 代理的用户名rhsm_server_proxy_password- HTTP 代理的密码rhsm_auto_attach- 如果注册成功,则自动使用可用的订阅(布尔值,默认为 false,需要 ansible >= 2.5)rhsm_environment- 在目标组织中注册到特定环境(与红帽 Satellite 6 或 Katello 一起使用)rhsm_pool- 要使用的特定池名称(可以使用正则表达式作为输入)。尽可能使用rhsm_pool_ids,因为这样速度更快。与rhsm_pool_ids互斥rhsm_pool_ids- 要使用的池 ID 列表,或包含池 ID 作为键和要使用的授权数量作为值的字典列表。与rhsm_pool互斥rhsm_consumer_type- 要注册的单元类型(默认为 "system")rhsm_consumer_name- 要注册的系统名称(默认为系统主机名)rhsm_consumer_id- 现有的消费者 ID 以恢复以前的注册rhsm_force_register- 即使系统已注册,也强制注册(布尔值,默认为 false)rhsm_unregister- 如果为 true,则注销系统。系统将被注销。系统注册 不会尝试 (布尔值,默认为 false)
库管理
注意:
使用与库管理相关的变量可能导致角色报告失败,如果系统未注册。 在处理这些变量之前,订阅任务会在库管理任务之前运行,以便于注册状态。
rhsm_release- 设置要使用的操作系统版本。请确保对看起来像浮点数的版本加引号,例如,将值设置为类似"7.4"的内容,而不是7.4。像6Server和7Server的值不需要加引号。rhsm_release_unset- 取消设置要使用的操作系统版本(布尔值,默认为 false)rhsm_repositories- 指定要启用/禁用的库,详情如下
要启用/禁用特定库:
rhsm_repositories:
enabled:
- enabled-repository
disabled:
- disabled-repository
在 disabled 列表中的库会在 enabled 之前处理。
要仅启用特定库并禁用所有其他库:
rhsm_repositories:
only:
- enabled-repository-1
- enabled-repository-2
使用 only 是以下配置的幂等性友好版本:
rhsm_repositories:
disabled:
- "*"
enabled:
- enabled-repository-1
- enabled-repository-2
注意,库名称支持通配符。
使用 only 与使用 enabled 和 disabled 互斥,并且使用 only 优先级更高。
要设置要使用的特定 RHEL 版本的库:
rhsm_release: "7.1"
要默认使用最新可用的库的次要版本:
rhsm_release_unset: true
角色输出
弃用警告 角色输出已被弃用,不再支持,并将在将来的版本中删除。
oasis_role_rhsm
此角色将设置 oasis_role_rhsm 事实,包含以下输出:
subscribed- 系统是否已注册。(布尔值)subscribed_pool_ids- 当前附加到系统的池 ID 列表。如果没有附加池,或系统当前未注册,则将是空列表。
依赖关系
需要支持安装和使用 subscription-manager 的系统,例如红帽企业 Linux。
此角色需要权限提升(sudo)。
示例剧本
该示例使用用户名和密码注册一个系统,自动附加,启用三个 RHEL 7 库,并显式将启用的库版本设置为 "7Server"。
- hosts: rhsm-servers
roles:
- role: rhsm
vars:
rhsm_username: your_username
rhsm_password: your_password
rhsm_auto_attach: true
rhsm_repositories:
only:
- rhel-7-server-rpms
- rhel-7-server-optional-rpms
- rhel-7-server-extras-rpms
rhsm_release: 7Server
该示例使用组织 ID 和激活密钥将一个系统注册到红帽 Satellite 6,并通过 ID 附加到特定池。
- hosts: rhsm-servers
roles:
- role: rhsm
vars:
rhsm_org_id: your_organization_id
rhsm_activationkey: activation_key
rhsm_pool_ids:
- poolid
rhsm_server_hostname: your.satellite6.hostname
使用 RHSM 提供者时,Satellite 6 或 Katello 主机的 CA 证书应先安装,以使 HTTPS 正常工作。
许可证
作者信息
Joel Castillo (@joelbcastillo) 代表纽约市档案部门开发团队 (@nycrecords)
从 Sean Myers semyers@redhat.com 复制的 (oasis-roles/rhsm)
Role to setup subscription management on RedHat Enterprise Linux. Forked from https://github.com/oasis-roles/rhsm
ansible-galaxy install nycrecords.rhsm