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 中,
以
ansible用户身份登录$ ssh ansible@envb_controller1.example.com注意此引用环境使用
envb_controller1作为包含 Ansible Automation Platform 安装程序目录和二进制文件的主机。下载 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
解压 ansible-automation-platform-setup-2.1.1-1.tar.gz
$ tar zxvf ansible-automation-platform-setup-2.1.1-1.tar.gz将目录改为 ansible-automation-platform-setup-2.1.1-1
$ cd ansible-automation-platform-setup-2.1.1-1/将 Ansible Automation Platform 1.2 清单文件复制到 ansible-automation-platform-setup-2.1.1-1 目录中
$ cp /path/to/ansible-tower-setup-3.8.5-X/inventory .使用 Ansible Automation Platform 安装程序复制的 Ansible Automation Platform 1.2 清单文件生成 Ansible Automation Platform 2 安装清单提议
$ ./setup.sh注意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."}建议 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注意变量
admin_password、pg_password和registry_password不是 inventory.new.ini 文件的一部分,因为不建议以纯文本形式存储密码。改为使用加密的 credentials.yml 文件。创建建议的
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=control3 peers=envb_datacenter_execution_nodes,envb_datacenter_hop_nodes4 [execution_nodes] envb_executionnode-1.example.com envb_executionnode-2.example.com envb_hopnnode-sacramento.example.com node_type=hop peers=sacramento_execution_nodes5 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使用以下选项运行
setup.sh以升级到 Ansible Automation Platform 2$ ./setup.sh -i inventory.new.ini -e @credentials.yml -- --ask-vault-pass验证所有自动化控制器节点都可以访问 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
有关清单文件中可设置的不同值的更多信息,请访问: 设置清单文件