3.4. 自动化控制器配置详情
此参考架构侧重于将 Ansible Automation Platform 1.2 迁移到 Ansible Automation Platform 2。该配置旨在提供一个全面的 Ansible Automation Platform 解决方案,涵盖 isde-side migration scenarios。本参考构架中涵盖的关键解决方案组件包括:
- Ansible Automation Platform 1.2
- Ansible Automation Platform 2
- Ansible Automation Platform 安装程序
- 用于自定义 Python 虚拟环境迁移的 Ansible Playbook
3.4.1. 操作系统配置 复制链接链接已复制到粘贴板!
3.4.1.1. chrony 配置 复制链接链接已复制到粘贴板!
集群中的每个 Ansible Automation Platform 节点都必须有权访问 NTP 服务器。chronyd 是一个用于同步系统时钟的守护进程。它可以与 NTP 服务器同步时钟。这样可确保当集群节点使用需要验证的 SSL 证书时,如果节点之间的日期和时间没有同步,则不会失败。
在 环境 B 上的所有节点上,包括用于 Ansible Automation Platform 集群扩展的、
如果没有安装,请安装
chrony,如下所示dnf install chrony --assumeyes
# dnf install chrony --assumeyesCopy to Clipboard Copied! Toggle word wrap Toggle overflow 使用文本编辑器(如
vi)编辑/etc/chrony.conf文件。vi /etc/chrony.conf
# vi /etc/chrony.confCopy to Clipboard Copied! Toggle word wrap Toggle overflow 找到以下公共服务器池部分,并将它修改为包含适当的服务器。只需要一个服务器,但建议使用三个服务器。添加
iburst选项,以加快与服务器正确同步所需的时间。# Use public servers from the pool.ntp.org project. # Please consider joining the pool (http://www.pool.ntp.org/join.html). server <ntp-server-address> iburst
# Use public servers from the pool.ntp.org project. # Please consider joining the pool (http://www.pool.ntp.org/join.html). server <ntp-server-address> iburstCopy to Clipboard Copied! Toggle word wrap Toggle overflow -
将所有更改保存到
/etc/chrony.conf文件中。 启动并启用
chronyd守护进程在主机引导时启动。systemctl --now enable chronyd.service
# systemctl --now enable chronyd.serviceCopy to Clipboard Copied! Toggle word wrap Toggle overflow 验证 chronyd 守护进程状态。
systemctl status chronyd.service
# systemctl status chronyd.serviceCopy to Clipboard Copied! Toggle word wrap Toggle overflow
3.4.1.2. Red Hat Subscription Manager 复制链接链接已复制到粘贴板!
subscription-manager 命令将系统注册到 Red Hat Network (RHN),并管理系统的订阅权利。--help 选项在命令行中指定,以查询可用选项的命令。如果与 command 指令一起发出 --help 选项,则会列出可用于特定 command 指令的选项。
要使用红帽订阅管理为系统提供软件包,系统必须首先注册到该服务。要注册系统,请使用 subscription-manager 命令并传递 register 命令指令。如果指定了 --username 和 --password 选项,则命令不会提示输入 RHN 网络身份验证凭据。
以下是使用 subscription-manager 注册系统的示例。
以下内容应在 环境 B 中的所有节点上完成,包括用于 Ansible Automation Platform 集群扩展的节点。
subscription-manager register --username [User] --password '[Password]' The system has been registered with id: abcd1234-ab12-ab12-ab12-481ba8187f60
# 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 attach --pool <pool_id> Successfully attached a subscription for: Red Hat Ansible Automation Platform, Premium (5000 Managed Nodes)
# 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
# subscription-manager repos --enable=ansible-automation-platform-2.1-for-rhel-8-x86_64-rpms
作为 Ansible Automation Platform 订阅的一部分,10 个 Red Hat Enterprise Linux (RHEL)订阅可用于您的自动化控制器、私有自动化中心和其他 Ansible Automation Platform 组件。
3.4.1.3. 用户帐户 复制链接链接已复制到粘贴板!
在安装 Ansible Automation Platform 2 之前,建议为部署过程创建一个具有 sudo 特权的非 root 用户。此用户用于:
- SSH 连接
- 在安装过程中进行免密码身份验证
- 权限升级(sudo)权限
然而,出于此参考环境,选择了 ansible 用户,但任何用户名都会挂起。
在 Environment B 上的所有节点上,包括用于 Ansible Automation Platform 集群扩展的节点,创建一个名为 ansible 的用户并生成 ssh 密钥。
创建非 root 用户
useradd ansible
# useradd ansibleCopy to Clipboard Copied! Toggle word wrap Toggle overflow 为您的
ansible用户设置密码。passwd ansible
# passwd ansibleCopy to Clipboard Copied! Toggle word wrap Toggle overflow 以
ansible用户身份生成ssh密钥。ssh-keygen -t rsa
$ ssh-keygen -t rsaCopy to Clipboard Copied! Toggle word wrap Toggle overflow 将
sudo用作ansible用户时禁用密码要求echo "ansible ALL=(ALL) NOPASSWD:ALL" | sudo tee -a /etc/sudoers.d/ansible
# echo "ansible ALL=(ALL) NOPASSWD:ALL" | sudo tee -a /etc/sudoers.d/ansibleCopy to Clipboard Copied! Toggle word wrap Toggle overflow
3.4.1.4. 将 SSH 密钥复制到所有节点 复制链接链接已复制到粘贴板!
创建 ansible 用户后,以 ansible 用户身份,将 ssh 密钥复制到 Environment B 上的所有节点,包括用于 Ansible Automation Platform 集群扩展的节点。这样可确保在 Ansible Automation Platform 安装运行时,它可以在没有密码的情况下 ssh 到所有节点。
这可以通过 ssh-copy-id 命令完成,如下所示:
ssh-copy-id ansible@hostname.example.com
$ ssh-copy-id ansible@hostname.example.com
如果在云供应商中运行,您可能需要创建一个 ~/.ssh/authorized_keys 文件,其中包含所有节点上的 ansible 用户的公钥,并将权限设置为 authorized_keys 文件,使其只能具有读写访问权限(权限 600)。
3.4.1.5. 配置防火墙设置 复制链接链接已复制到粘贴板!
防火墙访问和限制在保护 Ansible Automation Platform 2 环境时发挥了关键作用。Red Hat Enterprise Linux {rhel_version} 的使用默认为使用 firewalld,一个动态防火墙守护进程。firewalld 的工作原理是将网络区分配给网络及其关联的连接和接口。
建议将防火墙配置为允许访问成功 Ansible Automation Platform 2 安装的适当服务和端口。
在 环境 B 中的所有节点上,包括用于 Ansible Automation Platform 集群扩展的节点,确保已安装、启动和启用 firewalld。
安装
firewalld软件包dnf install firewalld --assumeyes
# dnf install firewalld --assumeyesCopy to Clipboard Copied! Toggle word wrap Toggle overflow 启动
firewalld服务systemctl start firewalld
# systemctl start firewalldCopy to Clipboard Copied! Toggle word wrap Toggle overflow 启用
firewalld服务systemctl enable firewalld
# systemctl enable firewalldCopy to Clipboard Copied! Toggle word wrap Toggle overflow