3.2. 操作系统配置
3.2.1. Red Hat Subscription Manager 复制链接链接已复制到粘贴板!
subscription-manager 命令将系统注册到 Red Hat Network (RHN),并管理系统的订阅权利。--help 选项在命令行中指定,以查询可用选项的命令。如果与 command 指令一起发出 --help 选项,则会列出可用于特定 command 指令的选项。
要使用红帽订阅管理为系统提供软件包,系统必须首先注册到该服务。要注册系统,请使用 subscription-manager 命令并传递 register 命令指令。如果指定了 --username 和 --password 选项,则命令不会提示输入 RHN 网络身份验证凭据。
以下是使用 subscription-manager 注册系统的示例。
# subscription-manager register --username [User] --password '[Password]'
The system has been registered with id: abcd1234-ab12-ab12-ab12-481ba8187f60
注册系统后,必须将其附加到授权池。在本参考环境中,Red Hat Ansible Automation Platform 是所选的池。识别并订阅 Red Hat Ansible Automation Platform 权利池,需要以下命令指令。
# subscription-manager list --available | grep -A8 "Red Hat Ansible Automation Platform"
---
Subscription Name: Red Hat Ansible Automation Platform, Premium (5000 Managed Nodes)
Provides: Red Hat Ansible Engine
Red Hat Single Sign-On
Red Hat Ansible Automation Platform
SKU: MCT3695
Contract: <contract>
Pool ID: <pool_id>
Provides Management: No
Available: 9990
Suggested: 1
Service Type: L1-L3
Roles:
# subscription-manager attach --pool <pool_id>
Successfully attached a subscription for: Red Hat Ansible Automation Platform, Premium (5000 Managed Nodes)
# subscription-manager repos --enable=ansible-automation-platform-2.1-for-rhel-8-x86_64-rpms
3.2.2. 用户帐户 复制链接链接已复制到粘贴板!
在安装 Ansible Automation Platform 2.1 之前,建议为部署过程创建一个具有 sudo 特权的非 root 用户。此用户用于:
- SSH 连接
- 在安装过程中进行免密码身份验证
然而,出于此参考环境,选择了 ansible 用户,但任何用户名都会挂起。
在所有节点上,创建一个名为 ansible 的用户并生成 ssh 密钥。
创建非 root 用户
# useradd ansible为您的
ansible用户设置密码。# passwd ansible以
ansible用户身份生成ssh密钥。$ ssh-keygen -t rsa将
sudo用作ansible用户时禁用密码要求# echo "ansible ALL=(ALL) NOPASSWD:ALL" | sudo tee -a /etc/sudoers.d/ansible
3.2.3. 将 SSH 密钥复制到所有节点 复制链接链接已复制到粘贴板!
以 ansible 用户身份创建 ansible 用户,将 ssh 密钥复制到所有节点。这样可确保在 Ansible Automation Platform 安装运行时,它可以在没有密码的情况下 ssh 到所有节点。
这可以通过 ssh-copy-id 命令完成,如下所示:
$ ssh-copy-id ansible@hostname.example.com
如果在云供应商中运行,您可能需要创建一个 ~/.ssh/authorized_keys 文件,其中包含所有节点上的 ansible 用户的公钥,并将权限设置为 authorized_keys 文件,使其只能具有读写访问权限(权限 644)。
3.2.4. 配置防火墙设置 复制链接链接已复制到粘贴板!
防火墙访问和限制在保护 Ansible Automation Platform 2.1 环境时扮演了关键角色。Red Hat Enterprise Linux 8.4 的使用默认为使用 firewalld,它是一个动态防火墙守护进程。firewalld 的工作原理是将网络区分配给网络及其关联的连接和接口。
建议将防火墙配置为允许访问成功 Ansible Automation Platform 2.1 安装的适当服务和端口。
在所有节点上,确保已安装、启动和启用 firewalld。
安装
firewalld软件包# dnf install firewalld --assumeyes启动
firewalld服务# systemctl start firewalld启用
firewalld服务# systemctl enable firewalld