Ansible Automation Platform 故障排除


Red Hat Ansible Automation Platform 2.5

对 Ansible Automation Platform 的问题进行故障排除

Red Hat Customer Content Services

摘要

本指南为 Red Hat Ansible Automation Platform 提供故障排除主题。

前言

使用故障排除 Ansible Automation Platform 指南来对 Ansible Automation Platform 安装进行故障排除。

对红帽文档提供反馈

如果您对本文档有任何改进建议,或发现错误,请通过 https://access.redhat.com 联系技术支持来创建一个请求。

免责声明 :这些信息中包含的指向外部网站的链接仅用于方便用户。红帽没有审阅链接的内容,并不对其内容负责。包含任何指向外部网站的链接并不表示红帽认可该网站或其实体、产品或服务。您同意红帽对因您使用(或依赖)外部网站或内容而导致的任何损失或费用不承担任何责任。

第 1 章 诊断问题

要开始对 Ansible Automation Platform 进行故障排除,请使用 OpenShift Container Platform 上的 must-gather 命令或基于虚拟机的安装中的 sos 实用程序来收集配置和诊断信息。您可以将这些工具的输出附加到支持问题单中。

oc adm must-gather 命令行界面(CLI)命令从 OpenShift Container Platform 上部署的 Ansible Automation Platform 安装收集信息。它收集调试问题通常需要的信息,包括资源定义和服务日志。

运行 oc adm must-gather CLI 命令会创建一个新目录,其中包含可用于排除故障或附加到您的支持问题单的数据。

如果您的 OpenShift 环境无法访问 registry.redhat.io,且您无法运行 must-gather 命令,则改为运行 oc adm inspect 命令。

先决条件

  • 已安装 OpenShift CLI (oc)。

流程

  1. 登录到集群:

    oc login <openshift_url>
  2. 根据集群中的访问级别运行以下命令之一:

    • 在整个集群中运行 must-gather

      oc adm must-gather --image=registry.redhat.io/ansible-automation-platform-25/aap-must-gather-rhel8 --dest-dir <dest_dir>
      • --image 指定收集数据的镜像
      • --dest-dir 指定输出的目录
    • 为集群中的特定命名空间运行 must-gather

      oc adm must-gather --image=registry.redhat.io/ansible-automation-platform-25/aap-must-gather-rhel8 --dest-dir <dest_dir> – /usr/bin/ns-gather <namespace>
      • - /usr/bin/ns-gathermust-gather 数据收集限制为指定的命名空间
  3. 要将 must-gather 归档附加到您的支持问题单中,请从之前创建的 must-gather 目录创建一个压缩文件,并将其附加到您的支持问题单中。

    • 例如,在使用 Linux 操作系统的计算机上,运行以下命令,将 < must-gather-local.5421342344627712289/&gt; 替换为 must-gather 目录名称:

      $ tar cvaf must-gather.tar.gz <must-gather.local.5421342344627712289/>

sos 实用程序在基于虚拟机的安装中从 Ansible Automation Platform 收集配置、诊断和故障排除数据。

有关安装和使用 sos 工具的更多信息,请参阅为技术支持生成 sos 报告

第 2 章 用于自动化控制器故障排除的资源

查找自动化控制器性能和日志记录问题故障排除的信息。

第 3 章 备份和恢复

查找有关 Ansible Automation Platform 的备份和恢复操作故障排除的信息。

  • 有关在 OpenShift Container Platform 上安装 Ansible Automation Platform Operator 的备份和恢复的详情,请参阅 Operator 环境的备份和恢复 中的 故障排除部分

第 4 章 执行环境

解决执行环境镜像的问题,包括"使用控制器"选项的问题。

您不能将 Use in Controller 选项用于私有自动化中心上的执行环境镜像。您还会收到错误消息:"No Controllers available"。

要解决这个问题,将自动化控制器连接到您的私有自动化中心实例。

流程

  1. 根据您的配置更改私有自动化中心上的 /etc/pulp/settings.py 文件,并添加以下参数之一:

    • 单个控制器

      CONNECTED_ANSIBLE_CONTROLLERS = ['<https://my.controller.node>']
    • 很多负载均衡器后面的控制器

      CONNECTED_ANSIBLE_CONTROLLERS = ['<https://my.controller.loadbalancer>']
    • 许多没有负载均衡器的控制器

      CONNECTED_ANSIBLE_CONTROLLERS = ['<https://my.controller.node1>', '<https://my.controller2.node2>']
  2. 停止所有私有自动化中心服务:

    # systemctl stop pulpcore.service pulpcore-api.service pulpcore-content.service pulpcore-worker@1.service pulpcore-worker@2.service nginx.service redis.service
  3. 重启所有私有自动化中心服务:

    # systemctl start pulpcore.service pulpcore-api.service pulpcore-content.service pulpcore-worker@1.service pulpcore-worker@2.service nginx.service redis.service

    验证

    • 验证现在是否可以在私有自动化中心中使用 Use in Controller 选项。

第 5 章 安装

查找有关对 Ansible Automation Platform 的容器化、Operator 和基于 RPM 的安装进行故障排除的信息。

第 6 章 Jobs

解决常见作业问题,包括模块解析错误、超时错误、待处理作业和权限错误。

作业失败并显示错误消息 "ERROR! couldn't resolve module/action 'module name'。这通常表示拼写错误、缺少集合或不正确的模块路径"。

当执行环境中缺少与模块关联的集合时,可能会出现此错误。

推荐的解决方案是创建自定义执行环境,并在该执行环境中添加所需的集合。有关创建执行环境的更多信息,请参阅 创建和使用执行环境 中的 使用 Ansible Builder

另外,您可以完成以下步骤:

流程

  1. 项目存储库 内创建一个集合文件夹。
  2. 集合 文件夹中添加 requirements.yml 文件并添加集合:

    collections:
    - <collection_name>

当超时值太小时,可能会出现这个错误,从而导致作业在完成前停止。连接插件的默认超时值是 10

要解决这个问题,请完成以下任一方法来增加超时值。

注意

以下更改将影响自动化控制器中的所有作业。要为特定项目使用超时值,请在项目目录的根目录中添加 ansible.cfg 文件,并将 timeout 参数值添加到 ansible.cfg 文件中。

流程

  • 使用以下方法之一增加超时值:

    • 在自动化控制器 UI 中添加 ANSIBLE_TIMEOUT 作为环境变量:

      1. 进入自动化控制器。
      2. 在导航面板中,选择 SettingsJobs settings
      3. Extra Environment Variables 下添加以下内容:

        {
        "ANSIBLE_TIMEOUT": 60
        }
    • 在 ansible.cfg 文件的 [defaults] 部分添加一个超时值:

      1. 编辑 /etc/ansible/ansible.cfg 文件并添加以下内容:

        [defaults]
        timeout = 60
    • 使用超时运行临时命令:

      1. 要在命令行中运行一个临时 playbook,请在 ansible-playbook 命令中添加 the-- timeout 标志,例如:

        # ansible-playbook --timeout=60 <your_playbook.yml>

在自动化控制器中启动作业后,作业将处于待处理状态,且不会启动。

有几个原因作业可能会一直处于待处理状态。有关对此问题进行故障排除的更多信息,请参阅配置自动化执行中的 Playbook 处于待处理状态

流程

  1. 运行以下命令列出所有待处理的作业:

    # awx-manage shell_plus
    >>> UnifiedJob.objects.filter(status='pending')
  2. 使用以下方法之一取消待处理的作业:

    • 要取消所有待处理的作业,请运行以下命令:

      >>> UnifiedJob.objects.filter(status='pending').update(status='canceled')
    • 要取消单个作业,请运行以下命令,将 < job_id&gt; 替换为要取消的作业 ID:

      >>> UnifiedJob.objects.filter(id=<job_id>).update(status='canceled')

作业失败并显示错误消息 "denied: requests to the resource is denied, unauthorized: Insufficient permissions"。当在私有自动化中心中使用执行环境时会出现这种情况。

当您使用密码或令牌保护私有自动化中心,但没有将 registry 凭证分配给执行环境时,会出现这种情况。

流程

  1. 进入自动化控制器。
  2. 在导航面板中,选择 AdministrationExecution Environments
  3. 单击分配给失败的作业模板的执行环境。
  4. Edit
  5. 将私有自动化中心中的适当的 Registry 凭证 分配给执行环境。

第 7 章 网络

解决包括子网冲突和 SSL/TLS 证书问题在内的网络问题。

7.1. 问题 - 容器子网与内部网络冲突

Ansible Automation Platform 容器中使用的默认子网与内部网络冲突,从而导致 "No route to host" 错误。

要解决这个问题,请更新默认的无类别域间路由(CIDR)值,使其不与默认 Podman 网络插件使用的 CIDR 冲突。

流程

  1. 在所有控制器和混合节点上,运行以下命令来创建名为 custom.py 的文件:

    # touch /etc/tower/conf.d/custom.py
    # chmod 640 /etc/tower/conf.d/custom.py
    # chown root:awx /etc/tower/conf.d/custom.py
  2. 将以下内容添加到 /etc/tower/conf.d/custom.py 文件中:

    DEFAULT_CONTAINER_RUN_OPTIONS = ['--network', 'slirp4netns:enable_ipv6=true,cidr=192.168.1.0/24']
    • 本例中是新 CIDR 的值。
  3. 在所有控制器和混合节点上停止并启动自动化控制器服务:

    # automation-controller-service stop
    # automation-controller-service start

    所有容器将在新 CIDR 上启动。

7.2. SSL/TLS 问题故障排除

要对 SSL/TLS 问题进行故障排除,请验证证书链,使用正确的证书,并确认可信证书颁发机构(CA)是否已签名。

流程

  1. 检查服务器是否可通过 SSL/TLS 访问。

    1. 运行以下命令,以确认服务器是否可通过 SSL/TLS 访问,并查看完整的证书链:

      # true | openssl s_client -showcerts -connect <fqdn_or_ip>:<port>
    2. 将 & lt;fqdn_or_ip> 和 & lt;port& gt; 替换为合适的值。
  2. 验证证书详情。

    1. 运行以下命令来查看证书详情:

      # openssl x509 -in <path_to_certificate> -noout -text
  3. <path_to_certificate > 替换为您要检查的证书文件的路径。

    命令的结果会显示如下信息:

    • 主题 - 证书已发布到的实体。
    • issuer - 发布证书的 CA。
    • validity "Not Before" - 证书发布的日期。
    • validity "Not After" - 证书过期的日期。
  4. 验证可信 CA 签署了证书。

    1. 运行以下命令,以验证特定证书是否有效,并由可信 CA 签名:

      openssl verify -CAfile <path_to_ca_public_certificate> <path_to_server_certificate_file_to_verify>
    2. 如果命令返回 OK,这表示证书文件由受信任的 CA 有效并签名。

第 8 章 Playbook

您可以使用自动化内容导航器以交互方式对 playbook 进行故障排除。有关更多信息,请参阅使用 自动化内容导航器对 Ansible 内容进行故障排除

第 9 章 升级

在升级到 Ansible Automation Platform 2.5 时排除问题。

当从 Ansible Automation Platform 2.4 升级到 2.5 时,升级可以成功完成。但是,如果您在负载均衡器后面使用自动化控制器,到平台网关 URL 的连接会失败。

您在日志中看到这个错误信息:

连接到控制器 API 时出错

流程

  1. 要解决这个问题,请对所有控制器主机执行以下任务:

    1. 对于每个控制器主机,在 settings.py 文件中的 CSRF_TRUSTED_ORIGIN 设置中添加平台网关 URL 作为可信源。

      例如,如果您将平台网关 URL 配置为 https://www.example.com,则必须在 settings.py 文件中添加该 URL,如下所示:

      CSRF_TRUSTED_ORIGINS = ['https://appX.example.com:8443','https://www.example.com']
    2. 使用 automation-controller-service restart 命令重启每个控制器主机,以便实施 URL 更改。具体步骤,请参阅配置自动化执行 中的 启动、停止和重启 自动化控制器

法律通告

Copyright © 2025 Red Hat, Inc.
The text of and illustrations in this document are licensed by Red Hat under a Creative Commons Attribution–Share Alike 3.0 Unported license ("CC-BY-SA"). An explanation of CC-BY-SA is available at http://creativecommons.org/licenses/by-sa/3.0/. In accordance with CC-BY-SA, if you distribute this document or an adaptation of it, you must provide the URL for the original version.
Red Hat, as the licensor of this document, waives the right to enforce, and agrees not to assert, Section 4d of CC-BY-SA to the fullest extent permitted by applicable law.
Red Hat, Red Hat Enterprise Linux, the Shadowman logo, the Red Hat logo, JBoss, OpenShift, Fedora, the Infinity logo, and RHCE are trademarks of Red Hat, Inc., registered in the United States and other countries.
Linux® is the registered trademark of Linus Torvalds in the United States and other countries.
Java® is a registered trademark of Oracle and/or its affiliates.
XFS® is a trademark of Silicon Graphics International Corp. or its subsidiaries in the United States and/or other countries.
MySQL® is a registered trademark of MySQL AB in the United States, the European Union and other countries.
Node.js® is an official trademark of Joyent. Red Hat is not formally related to or endorsed by the official Joyent Node.js open source or commercial project.
The OpenStack® Word Mark and OpenStack logo are either registered trademarks/service marks or trademarks/service marks of the OpenStack Foundation, in the United States and other countries and are used with the OpenStack Foundation's permission. We are not affiliated with, endorsed or sponsored by the OpenStack Foundation, or the OpenStack community.
All other trademarks are the property of their respective owners.
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

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

让开源更具包容性

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

關於紅帽

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

Theme

© 2026 Red Hat
返回顶部