搜索

3.4. 自动化控制器配置详情

download PDF

此参考架构侧重于将 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 集群扩展的、

  1. 如果没有安装,请安装 chrony,如下所示

    # dnf install chrony --assumeyes
  2. 使用文本编辑器(如 vi )编辑 /etc/chrony.conf 文件。

    # vi /etc/chrony.conf
  3. 找到以下公共服务器池部分,并将它修改为包含适当的服务器。只需要一个服务器,但建议使用三个服务器。添加 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
  4. 将所有更改保存到 /etc/chrony.conf 文件中。
  5. 启动并启用 chronyd 守护进程在主机引导时启动。

    # systemctl --now enable chronyd.service
  6. 验证 chronyd 守护进程状态。

    # systemctl status chronyd.service

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

注册系统后,必须将其附加到授权池。在本参考环境中,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
注意

作为 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 密钥。

  1. 创建非 root 用户

    # useradd ansible
  2. 为您的 ansible 用户设置密码。

    # passwd ansible
  3. ansible 用户身份生成 ssh 密钥。

    $ ssh-keygen -t rsa
  4. sudo 用作 ansible 用户时禁用密码要求

    # echo "ansible ALL=(ALL) NOPASSWD:ALL" | sudo tee -a /etc/sudoers.d/ansible

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/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

  1. 安装 firewalld 软件包

    # dnf install firewalld --assumeyes
  2. 启动 firewalld 服务

    # systemctl start firewalld
  3. 启用 firewalld 服务

    # systemctl enable firewalld
Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

© 2024 Red Hat, Inc.