You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用Ansible Playbook调用community.aws.redshift模块时遇错误求助

解决Ansible Tower找不到community.aws.redshift模块的问题

可能的原因及解决方案

1. 确保Ansible Tower执行环境已安装community.aws集合

Ansible Tower的执行环境与本地Ansible环境相互独立,即使本地已安装集合,Tower环境可能未同步:

  • 在项目根目录创建requirements.yml文件,指定需要的集合:
    collections:
      - name: community.aws
        version: 3.2.0 # 替换为你本地确认的有效版本
    
  • 在Tower项目设置中,勾选Install collections from requirements.yml选项,然后手动触发项目同步。
  • 若使用自定义执行环境,需重新构建执行环境以包含该集合。

2. 修正Playbook中的模块引用

  • 检查模块名称拼写是否完全正确,确保是community.aws.redshift,无大小写或字符错误。
  • 可在Playbook开头声明集合命名空间,简化模块引用:
    - hosts: localhost
      collections:
        - community.aws
      tasks:
        - name: start redshift
          redshift:
            id: myinstance-redshift
            state: started
            command: modify
    

3. 验证Tower执行环境配置

  • 进入Tower的执行环境页面,查看当前使用的执行环境详情,确认其中已包含community.aws集合。
  • 可通过在执行环境中运行ansible-galaxy collection list命令,直接验证集合是否存在。

4. 确认项目同步状态

  • 确保Tower已从版本控制系统拉取最新的项目文件(包括requirements.yml)。
  • 手动触发项目同步操作,再重新运行Playbook。

附:Redshift启停Playbook正确示例

# 启动Redshift集群
- name: Start Redshift Cluster
  community.aws.redshift:
    id: my-redshift-cluster
    state: started
    command: modify

# 停止Redshift集群
- name: Stop Redshift Cluster
  community.aws.redshift:
    id: my-redshift-cluster
    state: stopped
    command: modify

内容的提问来源于stack exchange,提问作者bala

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.30 17:16:27