5.2. 在命名空间中安装 Ansible Automation Platform Operator
使用这个流程为 Operator 订阅命名空间。
您无法在 OpenShift Cluster 上的 default 命名空间中部署 Ansible Automation Platform。建议使用 aap 命名空间。您可以使用自定义命名空间,但它应该只运行 Ansible Automation Platform。
流程
为 operator 创建项目
oc new-project ansible-automation-platform
oc new-project ansible-automation-platformCopy to Clipboard Copied! Toggle word wrap Toggle overflow -
创建名为
sub.yaml的文件。 将以下 YAML 代码添加到
sub.yaml文件中。Copy to Clipboard Copied! Toggle word wrap Toggle overflow 此文件创建一个名为
ansible-automation-platform的Subscription对象,它将ansible-automation-platform命名空间订阅到ansible-automation-platform-operatoroperator。然后,它会在
ansible-automation-platform命名空间中创建一个名为example的AutomationController对象。要从
示例更改自动化控制器名称,请编辑sub.yaml的kind: AutomationController部分中的 name 字段,并将 <automation_controller_name> 替换为您要使用的名称:apiVersion: automationcontroller.ansible.com/v1beta1 kind: AutomationController metadata: name: <automation_controller_name> namespace: ansible-automation-platform
apiVersion: automationcontroller.ansible.com/v1beta1 kind: AutomationController metadata: name: <automation_controller_name> namespace: ansible-automation-platformCopy to Clipboard Copied! Toggle word wrap Toggle overflow 运行
oc apply命令来创建sub.yaml文件中指定的对象:oc apply -f sub.yaml
oc apply -f sub.yamlCopy to Clipboard Copied! Toggle word wrap Toggle overflow
要验证命名空间是否已成功订阅到 ansible-automation-platform-operator operator,请运行 oc get subs 命令:
oc get subs -n ansible-automation-platform
$ oc get subs -n ansible-automation-platform
如需有关将命名空间订阅到 Operator 的更多信息,请参阅 Red Hat OpenShift Container Platform Operator 指南中的使用 CLI 从 OperatorHub 安装。
您可以使用 OpenShift Container Platform CLI 获取您创建的自动化控制器的 Web 地址和密码。