4.3. 将 环境 B 升级到 Ansible Automation Platform 2


成功导入 Ansible Automation Platform 数据库后,迁移过程中的最后一步是将 环境 B Ansible Automation Platform 1.2 环境升级到 Ansible Automation Platform 2,并扩展环境 B 的架构,如 图 1.4 “扩展环境 B 架构概述” 所示。

环境 B 中,

  1. ansible 用户身份登录

    $ ssh ansible@envb_controller1.example.com
    Copy to Clipboard Toggle word wrap
    注意

    此引用环境使用 envb_controller1 作为包含 Ansible Automation Platform 安装程序目录和二进制文件的主机。

  2. 下载 Ansible Automation Platform 2.1.1 Setup tar ansible-automation-platform-setup-2.1.1-1.tar.gz

    注意

    对于断开连接的安装,请下载 Ansible Automation Platform 2.1.1 Setup Bundle

  3. 解压 ansible-automation-platform-setup-2.1.1-1.tar.gz

    $ tar zxvf ansible-automation-platform-setup-2.1.1-1.tar.gz
    Copy to Clipboard Toggle word wrap
  4. 将目录改为 ansible-automation-platform-setup-2.1.1-1

    $ cd ansible-automation-platform-setup-2.1.1-1/
    Copy to Clipboard Toggle word wrap
  5. 将 Ansible Automation Platform 1.2 清单文件复制到 ansible-automation-platform-setup-2.1.1-1 目录中

    $ cp /path/to/ansible-tower-setup-3.8.5-X/inventory .
    Copy to Clipboard Toggle word wrap
  6. 使用 Ansible Automation Platform 安装程序复制的 Ansible Automation Platform 1.2 清单文件生成 Ansible Automation Platform 2 安装清单提议

    $ ./setup.sh
    Copy to Clipboard Toggle word wrap
    注意

    Ansible-core 在此过程中安装(如果尚未安装)。

    警告

    在创建提议 inventory.new.ini 时,预期的 Ansible Automation Platform 安装程序会在进程早期失败。

    预期错误任务类似如下:

    TASK [ansible.automation_platform_installer.check_config_static : Detect pre-2.x inventory and offer a migration] ***
    fatal: [172.16.58.48 -> localhost]: FAILED! => {"changed": false, "msg": "The installer has detected that you are using an inventory format from a version prior to 4.0. We have created an example inventory based on your old style inventory. Please check the file `/home/ansible/aap_install-2.1.1/ansible-automation-platform-setup-bundle-2.1.1-2/inventory.new.ini` and make necessary adjustments so that the file can be used by the installer."}
    Copy to Clipboard Toggle word wrap

    建议 inventory.new.ini

    [all:vars]
    pg_host='10.0.188.133'
    pg_port='5432'
    pg_database='awx'
    pg_username='awx'
    pg_sslmode='prefer'
    ansible_become='true'
    ansible_user='ansible'
    tower_package_name='automation-controller'
    tower_package_version='4.1.1'
    automationhub_package_name='automation-hub'
    automationhub_package_version='4.4.1'
    automation_platform_version='2.1.1'
    automation_platform_channel='ansible-automation-platform-2.1-for-rhel-8-x86_64-rpms'
    minimum_ansible_version='2.11'
    
    # In AAP 2.X [tower] has been renamed to [automationcontroller]
    # Nodes in [automationcontroller] will be hybrid by default, capable of executing user jobs.
    # To specify that any of these nodes should be control-only instead, give them a host var of `node_type=control`
    
    [automationcontroller]
    envb_controller1.example.com
    envb_controller2.example.com
    envb_controller3.example.com
    
    [database]
    envb_database.example.com
    Copy to Clipboard Toggle word wrap

    注意

    变量 admin_passwordpg_passwordregistry_password 不是 inventory.new.ini 文件的一部分,因为不建议以纯文本形式存储密码。改为使用加密的 credentials.yml 文件。

  7. 创建建议的 inventory.new.ini 后,修改该文件,使其包含包含跃点节点和执行节点的扩展环境 B 架构

    扩展环境 B inventory.new.ini

    [all:vars]
    pg_host='envb_database.example.com'
    pg_port='5432'
    pg_database='awx'
    pg_username='awx'
    pg_sslmode='prefer'
    ansible_become='true'
    ansible_user='ansible'
    tower_package_name='automation-controller'
    tower_package_version='4.1.1'
    automationhub_package_name='automation-hub'
    automationhub_package_version='4.4.1'
    automation_platform_version='2.1.1'
    automation_platform_channel='ansible-automation-platform-2.1-for-rhel-8-x86_64-rpms'
    minimum_ansible_version='2.11'
    registry_url='registry.redhat.io' 
    1
    
    registry_username='myusername' 
    2
    
    
    # In AAP 2.X [tower] has been renamed to [automationcontroller]
    # Nodes in [automationcontroller] will be hybrid by default, capable of executing user jobs.
    # To specify that any of these nodes should be control-only instead, give them a host var of `node_type=control`
    
    [automationcontroller]
    envb_controller1.example.com
    envb_controller2.example.com
    envb_controller3.example.com
    
    [database]
    envb_database.example.com
    
    [automationcontroller:vars]
    node_type=control 
    3
    
    peers=envb_datacenter_execution_nodes,envb_datacenter_hop_nodes 
    4
    
    
    [execution_nodes]
    envb_executionnode-1.example.com
    envb_executionnode-2.example.com
    envb_hopnnode-sacramento.example.com node_type=hop peers=sacramento_execution_nodes 
    5
    
    envb_hopnode-new-delhi.example.com node_type=hop peers=new-delhi_execution_nodes
    envb_hopnode-dublin.example.com node_type=hop peers=env_hopnode-new-delhi.example.com
    envb_executionnode-3.example.com
    envb_executionnode-4.example.com
    envb_executionnode-5.example.com
    envb_executionnode-6.example.com
    
    [envb_datacenter_execution_nodes] 
    6
    
    envb_executionnode-1.example.com
    envb_executionnode-2.example.com
    
    [envb_datacenter_hop_nodes] 
    7
    
    envb_hopnnode-sacramento.example.com
    envb_hopnode-new-delhi.example.com
    envb_hopnode-dublin.example.com
    
    [sacramento_execution_nodes] 
    8
    
    envb_executionnode-3.example.com
    envb_executionnode-4.example.com
    
    [new-delhi_execution_nodes] 
    9
    
    envb_executionnode-5.example.com
    envb_executionnode-6.example.com
    Copy to Clipboard Toggle word wrap

    1
    执行环境镜像已下载并包含在您的安装中。下载镜像所需的正确凭证。
    2
    用于访问 registry_url 的用户凭据。
    3
    控制节点运行项目和清单更新和系统作业,但不运行执行作业。这些节点上禁用了执行功能。
    4
    设置执行节点之间的对等关系。
    5
    设置跃点节点和执行节点之间的节点类型和对等关系。
    6
    具有直接访问自动化控制器节点的执行节点组。
    7
    将流量路由到其对应执行节点的跃点节点组。
    8
    通过 envb_hopnode-sacramento.example.com访问的执行节点组
    9
    通过 envb_hopnode-new-delhi.example.com访问的执行节点组
  8. 使用以下选项运行 setup.sh 以升级到 Ansible Automation Platform 2

    $ ./setup.sh -i inventory.new.ini -e @credentials.yml -- --ask-vault-pass
    Copy to Clipboard Toggle word wrap
  9. 验证所有自动化控制器节点都可以访问 Ansible Automation Platform 仪表板 UI。

    注意

    如果您在通过任何自动化控制器访问 Ansible Automation Platform 仪表板时遇到 502 错误或安全连接失败,这可能是因为以下其中一个或两个问题:

    • 证书不匹配
    • nginx的 SELinux 上下文不正确

    附录 D, 升级后 playbook 提供了修复这些问题的临时解决方案。当前正在实施修复,并在即将发布的点版本中修复。

    证书不匹配的问题已在 2.1.2 版和 Ansible Automation Platform 版本中解决。nginx 的不正确的 SELinux 上下文仍然需要临时解决方案 Ansible Playbook。检查 附录 D, 升级后 playbook 以了解更多详情。

此引用环境将 credentials.yml 用于以下变量:* admin_password * registry_password * pg_password

有关清单文件中可设置的不同值的更多信息,请访问: 设置清单文件

返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

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

让开源更具包容性

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

關於紅帽

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

Theme

© 2025 Red Hat